I'm trying to make a program in Visual Studio using asp.net that displays the results of a SQL Database in an HTML repeater table. I'm attempting to filter the data within the table so that you are able to display members who are "termed" or members who are "active". Here is my code so far <%@ Page Language="C#" AutoEventWireup="True" %> <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css"> <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap-theme.min.css"> <script src="http://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script> <script src="http://code.jquery.com/jquery.min.js"></script> <script src="js/bootstrap.min.js"></script> <link rel="stylesheet" type="text/css" href="//cdn.datatables.net/1.10.2/css/jquery.dataTables.css"> <script type="text/javascript" charset="utf8" src="//cdn.datatables.net/1.10.2/js/jquery.dataTables.js"></script> </head> <script runat="server"> void Search_Click(object sender, EventArgs e) { <!-- This is the part I was most confused about. I need help on what to put here --> @Title = DropDownList1.SelectedValue; } </script> <body> <form id="Form1" action="demo_form_action.asp" runat="server" method="get"> <asp:Button ID="Submit1" OnClick="Search_Click" Text="Log Out" runat="server" /> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem Selected>Activated</asp:ListItem> <asp:ListItem>Termed</asp:ListItem> </asp:DropDownList> </div> <div> <asp:Repeater ID="Repeater1" runat="server" DataSourceID="SqlDataSource1"> <HeaderTemplate> <table id="table_id" class="display"> <thead> <tr> <th>Subscriber ID</th> <th>First Name</th> <th>Last Name</th> <th>Birthdate</th> <th>Provider ID</th> <th>Payer</th> <th>HICN</th> <th>Medicare No.</th> <th>Medicaid No.</th> <th>Status</th> </tr> </thead> <tbody> </HeaderTemplate> <ItemTemplate> <tr> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label1" text='<%# Eval("CoverageID") %>' /> </td> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label2" text='<%# Eval("FirstName") %>' /> </td> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label3" text='<%# Eval("LastName") %>' /> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label4" text='<%# Eval("DOB") %>' /> </td> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label5" text='<%# Eval("ProviderID") %>' /> </td> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label6" text='<%# Eval("HPName") %>' /> </td> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label7" text='<%# Eval("HPOtherID") %>' /> </td> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label8" text='<%# Eval("MedicalID") %>' /> </td> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label9" text='<%# Eval("MedicareID") %>' /> </td> <td bgcolor="#CCFFCC"> <asp:Label runat="server" ID="Label10" text='<%# Eval("StatusName") %>' /> </td> </tr> </ItemTemplate> <FooterTemplate> </tbody> </table> </FooterTemplate> </asp:Repeater> <asp:SqlDataSource DataSourceMode = "Dataset" Enablecaching = "true" ConnectionString= "<%$ ConnectionStrings:UACConnectionString %>" ID="SqlDataSource1" runat="server" SelectCommand="SELECT DISTINCT MemberCoverages.CoverageID, Members.FirstName, Members.LastName, Members.DOB, MemberCoverages.ProviderID, HealthPlans.HPName, MemberCoverages.HPOtherID, MemberCoverages.MedicalID, MemberCoverages.MedicareID, StatusCodes.StatusName FROM MemberCoverages Join Members ON MemberCoverages.MemberID=Members.MemberID Join HealthPlans ON MemberCoverages.HPID=HealthPlans.HPID Join StatusCodes ON Membercoverages.StatusID=StatusCodes.StatusID WHERE [TermDate] IS NULL AND StatusName = @Title;"> <SelectParameters> <asp:ControlParameter Name ="Title" ControlID="DropDownList1" PropertyName="SelectedValue" /> </SelectParameters> </asp:SqlDataSource> </div> </form> </body> </html> So my app starts by displaying all members with a StatusName of "Active". And ideally, I want it to filter based off of the selected dropdown whenever the "Search_1" button is clicked. However, whenever I change the dropdown to "Termed" and click the button, I receive an error page that says "HTTP Error 414. The request URL is too long". So how can I make the Search_Click function filter based off of my dropdown choice? I'm new to programming so please explain in a clear and basic terminology if you can. I appreciate all help. :)
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)