如何打开单选按钮列表上的表格 [英] How to open the formds on radiobuttonlist

查看:83
本文介绍了如何打开单选按钮列表上的表格的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个单选按钮列表,其中包含适用于学生和员工的选项.如果用户选择学生,则学生字段将出现;如果用户选择雇员,则员工字段将出现在同一页面上.

I have a radiobutton list which contains option for student and employee . If user selects student then student fields will be come and if user selects employee then employee fields will come on same page. How to do it

推荐答案

这不是有效的问题.看看这个. ASP.NET RadioButtonList控件 [其示例 [ OnSelectedIndexChanged [ ^ ]事件.

继续.
Its not a valid question. Just take a look at this. ASP.NET RadioButtonList Control[^] & its example[^]

For your requirement, get the value in OnSelectedIndexChanged[^] event.

Go ahead.


根据您的要求使用此代码...

use this code as per your requirement...

protected void rdbList_SelectedIndexChanged(object sender, EventArgs e)
{
    string table = "";
    if (rdbDBSelection.SelectedIndex == 1)
    {
        table = "STUDENTLIST";
    }
    if(rdbDBSelection.SelectedIndex == 2)
    {
        table = "EMPLOYEE";
    }
    GetList(table);
}
GridView GridView1 = new GridView();
protected void GetList(string tableName)
{
    string query = "SELEFCT * FROM " + tableName;
    // fro firing select query and filling data table or data set code will goes here...
    // use that data table or data set as data source to your control like gridview or list view
    // here i use a grid view for demo perpose
    GridView1.DataSource = ds;
    GridView1.DataBind();
}




将所有与学生相关的字段放在一个窗格中,并将所有与员工相关的字段放在一个面板中.

当您单击学生单选按钮时,然后将学生面板的可见性设置为true

当您单击employeeradiobutton时,然后将雇员面板可见性设置为true

当您首先加载页面时,默认情况下会选中一个单选按钮并使相应的面板可见


希望这会有所帮助,

谢谢&问候
斯里曼


Place all the student related fields in one panle and all the employee related fields in one panel.

When you click student radiobutton then set student panel visibility to true

When you click employeeradiobutton then set employee panel visibility to true

When you load page for first check one radiobutton by default and make corresponding panel visible


Hope this helps,

Thanks & Regards
Sriman


这篇关于如何打开单选按钮列表上的表格的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆