ASP.net中RadioButtonList控件出现的这个问题怎么解决?急! 20
SqlConnectioncon=newSqlConnection("datasource=.;initialcatalog=SMS;IntegratedSecurity...
SqlConnection con = new SqlConnection("data source=.;initial catalog=SMS;Integrated Security=true");
con.Open();
string sql;
if (RadioButtonList.SelectedValue ==“”)
{
sql = "select * from Student order by Stuid";
}
else
{
sql = "select * from Student order by Stuname";
}
SqlDataAdapter da = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
我在CliCK中输入下面的代码 老是提醒我说没有RadioButtonList这个控件,但是这个控件明显就在页面里存在着,重新拖放,换该页面都试过了,就是不行,想请教高手们来给我指导一下,谢谢!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class sna : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("data source=.;initial catalog=SMS;Integrated Security=true");
con.Open();
string sql;
if (RadioButtonList1.SelectedValue ==“sno”)//RadioButton里面有两个值:sno sna
{
sql = "select * from Student order by Stuid";
}
else
{
sql = "select * from Student order by Stuname";
}
SqlDataAdapter da = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
} 展开
con.Open();
string sql;
if (RadioButtonList.SelectedValue ==“”)
{
sql = "select * from Student order by Stuid";
}
else
{
sql = "select * from Student order by Stuname";
}
SqlDataAdapter da = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
我在CliCK中输入下面的代码 老是提醒我说没有RadioButtonList这个控件,但是这个控件明显就在页面里存在着,重新拖放,换该页面都试过了,就是不行,想请教高手们来给我指导一下,谢谢!
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
public partial class sna : System.Web.UI.Page
{
protected void Button1_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("data source=.;initial catalog=SMS;Integrated Security=true");
con.Open();
string sql;
if (RadioButtonList1.SelectedValue ==“sno”)//RadioButton里面有两个值:sno sna
{
sql = "select * from Student order by Stuid";
}
else
{
sql = "select * from Student order by Stuname";
}
SqlDataAdapter da = new SqlDataAdapter(sql, con);
DataSet ds = new DataSet();
da.Fill(ds);
GridView1.DataSource = ds;
GridView1.DataBind();
con.Close();
}
} 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询