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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ASP:GridView - Passing TextBox value to procedure

Status
Not open for further replies.

pgraves

Programmer
Aug 30, 2006
10
GB
Hi all,

I have a TextBox and am trying to pass it's value to a SQL Server procedure specified in an asp:GridView. The GridView works fine if I put in a default value but doesn't seem to pick up the form value, in fact after running the profiler there is no call to the procedure at all.

The code I am using is:
-----------------------------------------------
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "
<html xmlns=" >
<head id="Head1" runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server" Text="405"></asp:TextBox><br />

<br />

<asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource1" PageSize="10" AllowPaging="True" AutoGenerateColumns="False" GridLines="Horizontal">
<Columns>
<asp:BoundField DataField="MTGDATE" HeaderText="Date" SortExpression="MTGDATE" ItemStyle-HorizontalAlign="Center" >
<HeaderStyle Width="100px" />
</asp:BoundField>
<asp:CommandField ShowSelectButton="True" />
</Columns>
</asp:GridView>

<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:WestpacConnectionString %>" SelectCommand="PersonProcedure" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:FormParameter Direction="Input" FormField="TexBox1" Name="AUserKey" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
</div>
</form>
</body>
</html>
-----------------------------------------------

I appreciate any help on this.

Pgraves
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top