I think my problem is that I'm just not understanding what is happening on my page...
I have a textbox and a button that takes the value of the textbox and performs a SQL Search against a viewgrid...
<asp:GridView ID="GridView2" runat="server" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
CellPadding="3" CellSpacing="2" AlternatingRowStyle-BackColor="#CCFFFF" >
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<Columns>
<asp:HyperLinkField DataTextField="Account_Number" HeaderText="AccountNumber"
NavigateUrl="[0]&country=[1]" SortExpression="Account_Number" />
<asp:BoundField DataField="Full_Name" HeaderText="Full_Name"
SortExpression="Full_Name" />
<asp:BoundField DataField="Last_Name" HeaderText="Last_Name"
SortExpression="Last_Name" />
<asp:BoundField DataField="Social_Number" HeaderText="Social_Number"
SortExpression="Social_Number" />
</Columns>
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#CCFFFF"></AlternatingRowStyle>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStringsurgedAccountsConnectionString %>" >
</asp:SqlDataSource>
______________
When I click the button, I perform the search and fill the grid as such...
Sub RunQuery()
SqlDataSource1.SelectCommand = "Select * FROM ALPAccounts WHERE Last_Name LIKE '" & TextBox1.Text & "' ORDER BY Full_Name"
End Sub
___________
I've tried using the GridView2_Sorting sub, but that didn't get me anywhere. Why is this so difficult. What should I be doing?
I have a textbox and a button that takes the value of the textbox and performs a SQL Search against a viewgrid...
<asp:GridView ID="GridView2" runat="server" AllowSorting="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
BackColor="#DEBA84" BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px"
CellPadding="3" CellSpacing="2" AlternatingRowStyle-BackColor="#CCFFFF" >
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<Columns>
<asp:HyperLinkField DataTextField="Account_Number" HeaderText="AccountNumber"
NavigateUrl="[0]&country=[1]" SortExpression="Account_Number" />
<asp:BoundField DataField="Full_Name" HeaderText="Full_Name"
SortExpression="Full_Name" />
<asp:BoundField DataField="Last_Name" HeaderText="Last_Name"
SortExpression="Last_Name" />
<asp:BoundField DataField="Social_Number" HeaderText="Social_Number"
SortExpression="Social_Number" />
</Columns>
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="#CCFFFF"></AlternatingRowStyle>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStringsurgedAccountsConnectionString %>" >
</asp:SqlDataSource>
______________
When I click the button, I perform the search and fill the grid as such...
Sub RunQuery()
SqlDataSource1.SelectCommand = "Select * FROM ALPAccounts WHERE Last_Name LIKE '" & TextBox1.Text & "' ORDER BY Full_Name"
End Sub
___________
I've tried using the GridView2_Sorting sub, but that didn't get me anywhere. Why is this so difficult. What should I be doing?