M
Mike P
I am using a GridView with 3 SelectParameters 2 of which are
ControlParameters, but the third of my SelectParameter values is derived
through my code rather than a QueryString, Control etc, so I need to add
my select parameters programmatically.
Here are my 2 ControlParameters are they were originally :
<SelectParameters>
<asp:ControlParameter Name="Month"
ControlID="ddlMonth" PropertyName="SelectedValue" />
<asp:ControlParameter Name="Year" ControlID="ddlYear"
PropertyName="SelectedValue" />
</SelectParameters>
And here are all 3 of my parameters declared within my Page_Load instead
:
SqlDataSource1.SelectParameters.Add("UserKey", TypeCode.Int32,
UserKey.ToString());
SqlDataSource1.SelectParameters.Add("Month", TypeCode.String,
ddlMonth.SelectedValue);
SqlDataSource1.SelectParameters.Add("Year", TypeCode.String,
ddlYear.SelectedValue);
Is this the right way to do this programmatically?
ControlParameters, but the third of my SelectParameter values is derived
through my code rather than a QueryString, Control etc, so I need to add
my select parameters programmatically.
Here are my 2 ControlParameters are they were originally :
<SelectParameters>
<asp:ControlParameter Name="Month"
ControlID="ddlMonth" PropertyName="SelectedValue" />
<asp:ControlParameter Name="Year" ControlID="ddlYear"
PropertyName="SelectedValue" />
</SelectParameters>
And here are all 3 of my parameters declared within my Page_Load instead
:
SqlDataSource1.SelectParameters.Add("UserKey", TypeCode.Int32,
UserKey.ToString());
SqlDataSource1.SelectParameters.Add("Month", TypeCode.String,
ddlMonth.SelectedValue);
SqlDataSource1.SelectParameters.Add("Year", TypeCode.String,
ddlYear.SelectedValue);
Is this the right way to do this programmatically?