nevergiveup01
Programmer
I have a datagrid on a page called(quote.aspx)that when the customer selects their name their CustID is suppsed to be carried over to another page (quote2.aspx). I think that all works except I don't know how to get the CustID inside a form on the second page.(quote2.aspx). How do you retrieve it? Below is the HTML/javascript part
my quote.aspx.vb code
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GV1.RowCommand
If e.CommandName = "ViewDetails" Then
' Retrieve row ID from DataKey.
Dim ViewDetailsButton As Button = DirectCast(e.CommandSource, Button)
Dim gvr As GridViewRow = DirectCast(ViewDetailsButton.NamingContainer, GridViewRow)
Dim id As Integer = Convert.ToInt32(GV1.DataKeys(gvr.RowIndex).Value)
Response.Redirect("Quote2.aspx", True)
End If
End Sub
part of my html/javascript code
<td style="width: 126px; border-bottom-color: black; height: 22px;">
Step1<br />
Please type your last name in the text box and press enter</td>
<td style="width: 100px; border-bottom-color: black; height: 22px;">
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 126px; border-bottom-color: black;">
Step2<br />
Please select your information:</td>
<td style="width: 100px; border-bottom-color: black;">
<asp:GridView ID="GV1" runat="server" DataKeyNames="CustID" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" AllowPaging="True">
<columns>
<asp:TemplateField HeaderText="Show Details">
<ItemTemplate>
<asp:Button ID="btnViewDetails" runat="server" commandname="ViewDetails" Text="Quote Request" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Customer ID" DataField="CustID" ReadOnly="True" />
<asp:BoundField HeaderText="First Name" DataField="Fname" />
<asp:BoundField HeaderText="Last Name" DataField="Lname" />
</columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestFeetConnectionString %>"
SelectCommand="SELECT * FROM [tblCustomer] WHERE ([Lname] = @Lname)">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="Lname" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>
my quote.aspx.vb code
Protected Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As GridViewCommandEventArgs) Handles GV1.RowCommand
If e.CommandName = "ViewDetails" Then
' Retrieve row ID from DataKey.
Dim ViewDetailsButton As Button = DirectCast(e.CommandSource, Button)
Dim gvr As GridViewRow = DirectCast(ViewDetailsButton.NamingContainer, GridViewRow)
Dim id As Integer = Convert.ToInt32(GV1.DataKeys(gvr.RowIndex).Value)
Response.Redirect("Quote2.aspx", True)
End If
End Sub
part of my html/javascript code
<td style="width: 126px; border-bottom-color: black; height: 22px;">
Step1<br />
Please type your last name in the text box and press enter</td>
<td style="width: 100px; border-bottom-color: black; height: 22px;">
<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox></td>
</tr>
<tr>
<td style="width: 126px; border-bottom-color: black;">
Step2<br />
Please select your information:</td>
<td style="width: 100px; border-bottom-color: black;">
<asp:GridView ID="GV1" runat="server" DataKeyNames="CustID" AutoGenerateColumns="False" DataSourceID="SqlDataSource1" AllowPaging="True">
<columns>
<asp:TemplateField HeaderText="Show Details">
<ItemTemplate>
<asp:Button ID="btnViewDetails" runat="server" commandname="ViewDetails" Text="Quote Request" />
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Customer ID" DataField="CustID" ReadOnly="True" />
<asp:BoundField HeaderText="First Name" DataField="Fname" />
<asp:BoundField HeaderText="Last Name" DataField="Lname" />
</columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:TestFeetConnectionString %>"
SelectCommand="SELECT * FROM [tblCustomer] WHERE ([Lname] = @Lname)">
<SelectParameters>
<asp:ControlParameter ControlID="TextBox1" Name="Lname" PropertyName="Text" Type="String" />
</SelectParameters>
</asp:SqlDataSource>