Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Set QueryStringField from Code (http://www.velocityreviews.com/forums/t647994-set-querystringfield-from-code.html)

Jonathan Wood 12-10-2008 03:24 AM

Set QueryStringField from Code
 
I'd like to program my ObjectDataSource object from my page's Load event.

Initially, the object is defined like this:

<asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
SelectMethod="Select" TypeName="SoftCircuits.Sounds" EnablePaging="True"
StartRowIndexParameterName="startRow" MaximumRowsParameterName="maxRows"
SelectCountMethod="SelectCount" >
<SelectParameters>
<asp:QueryStringParameter DefaultValue="0" Name="categoryId"
QueryStringField="cat" Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>

I want to write code to change the parameter to be a different type and
based on a different querystring. I started with this:

Parameter parm = ObjectDataSource1.SelectParameters[0];
parm.Name = "find";
parm.Type = TypeCode.String;

But Parameter has no property that specify which query string it uses, or
even if it uses a query string. How can I change this programatically?

Thanks.

Jonathan


Jonathan Wood 12-10-2008 03:38 AM

Re: Set QueryStringField from Code
 
After playing with this, I'm thinking this is the answer:

QueryStringParameter parm =
(QueryStringParameter)ObjectDataSource1.SelectPara meters[0];

Jonathan

"Jonathan Wood" <jwood@softcircuits.com> wrote in message
news:uCx7NbnWJHA.5108@TK2MSFTNGP04.phx.gbl...
> I'd like to program my ObjectDataSource object from my page's Load event.
>
> Initially, the object is defined like this:
>
> <asp:ObjectDataSource ID="ObjectDataSource1" runat="server"
> SelectMethod="Select" TypeName="SoftCircuits.Sounds" EnablePaging="True"
> StartRowIndexParameterName="startRow" MaximumRowsParameterName="maxRows"
> SelectCountMethod="SelectCount" >
> <SelectParameters>
> <asp:QueryStringParameter DefaultValue="0" Name="categoryId"
> QueryStringField="cat" Type="Int32" />
> </SelectParameters>
> </asp:ObjectDataSource>
>
> I want to write code to change the parameter to be a different type and
> based on a different querystring. I started with this:
>
> Parameter parm = ObjectDataSource1.SelectParameters[0];
> parm.Name = "find";
> parm.Type = TypeCode.String;
>
> But Parameter has no property that specify which query string it uses, or
> even if it uses a query string. How can I change this programatically?
>
> Thanks.
>
> Jonathan
>




All times are GMT. The time now is 09:14 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.