<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication5.WebForm1" %> <!DOCTYPE html> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> </head> <body> <form id="form1" runat="server"> <div> <asp:RadioButtonList ID="RadioButtonList1" runat="server"> <asp:ListItem Value="1">Query 1</asp:ListItem> <asp:ListItem Value="2">Query 2</asp:ListItem> <asp:ListItem Value="3">Query 3</asp:ListItem> </asp:RadioButtonList> </div> <asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /> <p> <asp:Label ID="Label1" runat="server" Text="Label"></asp:Label> </p> <asp:PlaceHolder ID="PlaceHolder1" runat="server"></asp:PlaceHolder> </form> </body> </html>WebForm.aspx.cs
using System; namespace WebApplication5 { public partial class WebForm1 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { } protected void Button1_Click(object sender, EventArgs e) { Label1.Text = "Selected: " + RadioButtonList1.SelectedItem.ToString(); switch (RadioButtonList1.SelectedValue) { case "1": // Query 1 break; case "2": // Query 2 break; case "3": // Query 3 break; } } } }The GridView I would like to insert into PlaceHolder looks like (it would be really cool if the columns were auto generated, but I'll settle for manually specifying them like this for now):
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:DatabaseConnectionString %>" SelectCommand="SELECT * FROM [MyTable]"></asp:SqlDataSource> <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataSourceID="SqlDataSource1"> <Columns> <asp:BoundField DataField="Customer Name" HeaderText="Customer Name" /> <asp:BoundField DataField="Address" HeaderText="Address" /> </Columns> </asp:GridView>I'll have 2 other GridViews defined similar to this one for Query 2 and Query 3.
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE