小编Ali*_*hnn的帖子

DropdownList DataSource

大家好,我有关于下拉列表的问题.我正在使用带数据源的下拉列表.我怎样才能获得我选择的那个值?

// I need a if statement here because my programme doesn't know which value of dropdown list selected and I don't know how to use this with datasource.

if(//if I select quiz 1 from dropdown list ,quiz 1 should list questions.)

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RegConnectionString"].ConnectionString);

string chooce = "Select Quiz from tblQuiz where Quiz=1 ";
SqlCommand userExist = new SqlCommand(chooce, con);
con.Open();
int temp = Convert.ToInt32(userExist.ExecuteScalar().ToString());

if (temp == 1)
{
    if (rbList.Items[0].Selected == true)
    {
        string cmdStr …
Run Code Online (Sandbox Code Playgroud)

.net c# sql asp.net

8
推荐指数
1
解决办法
10万
查看次数

标签 统计

.net ×1

asp.net ×1

c# ×1

sql ×1