Forum Moderators: open
My first simple problem using code behind pages is that I can not find my form variables. I am using
Partial Class CCTDetail
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Label1.Text = Request.Form("CCTNo")
End Sub
End Class
to try and output the form variable CCTNO, but nothing is appearing in the label area.
I am also using
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NetworkResilienceConnectionString %>"
SelectCommand="SELECT [id], [nodes] FROM [TBL_NR_CCTS] WHERE ([cctno] = @CCTNo)">
<SelectParameters>
<asp:QueryStringParameter Name="CCTNo" Type="Int32" QueryStringField="CCTNo" />
</SelectParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="id" HeaderText="id" InsertVisible="False" ReadOnly="True" />
<asp:BoundField DataField="nodes" HeaderText="nodes" SortExpression="nodes" />
</Columns>
</asp:GridView>
to do a simple query but that is not working either.
How should I referance the variable?
[edited by: Hamishrock at 8:40 am (utc) on April 10, 2008]
in the entry page to call the output page, and changing to a normal html input box
<input type="text" name="cct" />
allows me to set the select parameter by
<asp:FormParameter Name="cct" Type="int32" FormField="cct" />.
But how do I set my select parameter if I use the <asp:TextBox as the entry box?