Asp.net C#
in my database, i have 4 tables
i have to use RadioButtonList and select one of the items.
- annualleave
- emergencyleave
- medicalleave
- maternityleave
- specialleave
i need to show the table of the data in a link of another page.
please help, im out of ideas.
onselectedindexchanged="RDB_SelectedIndexChanged" Selected="True">
3 Replies
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Karthik RajPosted Aug 27, 2014, 3:46 AM
Try like this
step 1: In aspx design page for radiobutton list give the value of each button with its responsive table names and AutoPostBack="true"
ex:
Step2: In .cs file on "rbtn_SelectedIndexChanged" event call the page you required like this with parameters "Table name" and "Item Name"
if (rbtn.SelectedIndex > 0)
{
Response.Redirect("~/result.aspx?tblname=" + rbtn.SelectedValue.ToString() + "&&itemname=" + rbtn.SelectedItem.Text + "");
}
Step 3: In Result page or ur required page make a function to call your required database using the table name parameter
public void getTable(string tablename)
{
string Qry = "select * from "+tablename+"";
....
.....
....
}
step 4: In Result on load page
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.QueryString["itemname"] != "" && Request.QueryString["tblname"] != "")
{
getTable(Request.QueryString["tblname"].ToString());
}
}
}
Try in this formate...
Ayu MarzukiPosted Aug 27, 2014, 2:20 AM
Abhishek KumarPosted Aug 26, 2014, 9:33 AM
Please find the sample app attached for above requirement.
Abhishek