Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

gridview_rowcommand

Status
Not open for further replies.

nevergiveup01

Programmer
Nov 18, 2008
18
0
0
US
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;">
&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp; &nbsp; &nbsp; &nbsp;
&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;
<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>
 
YOu have to passe the value in a query string if you are going to redirect.
 
I know how to pass the value just not how to retrieve it in the new page.. Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top