WellsCarrie
Well-known member
My requirements call for the user to beable to search the Name field on my grid view. The business owner wants the search box to be located in the Name column's header.
I can make the page look correct and the Image button calls back to the server with it's command event just fine. But I can't figure out how to access the contents of the text box. In .net 1.1 I'd just do this:
But aparently my txtSearchName does not actually exist so I bomb when I try to read the ".text" property.
I've tried looking this up on the web and no one else seems to do it. The MSDN sight keeps crashing and I'm about to pull my hair out.
Can anyone suggest a solution or point me to an artical not on the MSDN website?
VB.NET:
<asp:TemplateField HeaderStyle-HorizontalAlign="Left" HeaderStyle-VerticalAlign="bottom" ItemStyle-Font-Size="10px" ItemStyle-Font-Bold="true">
<HeaderTemplate>
<asp:Label ID="lblHeaderText" runat="server" CssClass="label" Text="Name " />
<asp:TextBox ID="txtSearchName" CssClass="textbox" MaxLength="40" Width="60" Runat="Server" />
<asp:ImageButton ID="btnSearch" runat="server" ImageUrl="images/SearchImage.JPG" ImageAlign="bottom"
AlternateText="SEARCH NAME" CommandName="SearchNames" CommandArgument='<%# Eval("txtSearchName.Text") %>' />
</HeaderTemplate>
<ItemTemplate>
<asp:Label ID="lblName" Runat="server" Text='<%# Container.DataItem("name") %>' />
</ItemTemplate>
</asp:TemplateField>
I can make the page look correct and the Image button calls back to the server with it's command event just fine. But I can't figure out how to access the contents of the text box. In .net 1.1 I'd just do this:
VB.NET:
Dim tbDescription As System.Web.UI.WebControls.TextBox
tbSearchName = e.Item.FindControl("txtSearchName")
But aparently my txtSearchName does not actually exist so I bomb when I try to read the ".text" property.
I've tried looking this up on the web and no one else seems to do it. The MSDN sight keeps crashing and I'm about to pull my hair out.
Can anyone suggest a solution or point me to an artical not on the MSDN website?