![]() |
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 |
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 10:26 PM. |
Powered by vBulletin®. Copyright ©2000 - 2013, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.