Portal Engine
Version 2.x > Portal Engine > Trouble attaching parameters to repeater View modes: 
User avatar
Member
Member
craig.powell@ctpcomputers.co.uk - 1/29/2008 1:51:28 PM
   
Trouble attaching parameters to repeater
I know this is a newbie question, but I've been reading etc for days and cant work it out.
I have no c# experience and thereore have just been using the portal engine and trying to read stuff. I have created a stored procedure both via the site manager and SQL Server but can't pass parameters. I've entered the sp name into the query name and added the f following to the code tab, but receiving an error stating my sp requires parameter @param1 which was not supplied. Were am I going wrong?

<script runat=server>
protected void Page_Load(object sender, EventArgs e)
{
object[,] params = new object[1,2];
params[0,1] = "@param1";
params[0,2] = "26";
this.WebControlID.QueryParameters = params;
}
</script>

Thankyou for any help

User avatar
Member
Member
kentico_vitaja - 1/29/2008 3:09:50 PM
   
RE:Trouble attaching parameters to repeater
Hello,

it seems that you have several parts of your source code wrong:

..
object[,] params = new object[1,3];
params[0,0] = "@param1";
params[0,1] = "26";
..

Your code should be working now.

Best regards,
Vita Janecek

User avatar
Member
Member
craig.powell@ctpcomputers.co.uk - 1/29/2008 3:46:31 PM
   
RE:Trouble attaching parameters to repeater
Thank you for that, but I am still receiving the same error.
The query created in the site manager, as a stored procedure, under document types etc is called "AreaPostSPTest".
It has one line which is "News_In_Your_Area_Test".
This is a stored procedure I created in SQL server consisting of
Select blogname, blogbody, blogareaid from cms_areablogpost where blogareaid=@AreaID

The web part is a "Repeater with custom query" with an ID of "aaaa". "Query name:" is set to "cms.areablogpost.AreaPostSPTest" and the transformation is "cms.blogpost.areablogpost"

I'm still getting the "'News_In_Your_Area_Test' expects aprameter '@AreaID', which was not supplied." error.

User avatar
Member
Member
kentico_vitaja - 1/29/2008 4:23:26 PM
   
RE:Trouble attaching parameters to repeater
Hi,

Considering all information available - most likely is this issue caused by handing control too late. Please, instead of using Page_Load try to use OnInit() or any previous action to make sure everything will be loaded correctly.

Best regards,
Vita Janecek

User avatar
Member
Member
kentico_vitaja - 1/29/2008 4:40:23 PM
   
RE:Trouble attaching parameters to repeater
Hi,

Considering all information available - most likely is this issue caused by handing control too late. Please, instead of using Page_Load try to use OnInit() or any previous action to make sure everything will be loaded correctly.

Best regards,
Vita Janecek