选择dropdownlist 做条件查询怎么取不到dropdownlist的值是怎么回事
选择dropdownlist 做条件查询怎么取不到dropdownlist的值是怎么回事 --------------------编程问答-------------------- 猜不出来. --------------------编程问答-------------------- javascript取值还是cs文件里取值 --------------------编程问答-------------------- Page_Load(){
if(!IsPostBack)
{
...
}
} --------------------编程问答-------------------- 你没传值?你没绑定?你代码也要贴出来的。 --------------------编程问答-------------------- 看一下你绑定dropdownlist函数和ispostback --------------------编程问答-------------------- 贴一下代码, --------------------编程问答-------------------- 不好意思,大家.问题解决了 --------------------编程问答-------------------- 我想问一下,绑定如何空值
//第一次访问
if (!IsPostBack)
{
//根据参数设置当前页码
string cPageIndex = Request["pageindex"];
if (cPageIndex != null && !"".Equals(cPageIndex))
this.AspNetPagerNews.CurrentPageIndex = Int32.Parse(cPageIndex);
//根据参数操作搜索session
if (Request["isSearch"] == null || "".Equals(Request["isSearch"]))
{
Session.Remove("SUN002");
Session.Remove("NewsTypeList");
}
else
{
this.SUN002.Text = Session["SUN002"].ToString();
this.NewsTypeList.Text = Session["NewsTypeList"].ToString();
}
//绑定新闻类型数据
this.NewsTypeList.DataSource = new OA_NEWS_MANAGE_ACTION().GetDataNewsTypeSource();
//绑定
this.NewsTypeList.DataBind();
//绑定后添加请选择
ListItem lt = new ListItem();
lt.Text = "请选择";
lt.Value = "";
lt.Selected = true;
this.NewsTypeList.Items.Add(lt);
/* */
GetDataList();
}
}
/// <summary>
/// 功能 : 为当前页面datalist绑定数据
/// 参数类型 : 无
/// 返回值类型: 无
/// 备注 :
/// </summary>
public void GetDataList()
{
//取得查询条件
string sUN002 = this.SUN002.Text.Trim();
string sNewsType = this.NewsTypeList.Text;
//string sNewsType = this.NewsType.Text;
string whereString = "DELTAG=0 ";
//加入条件查询
if (null != sUN002 && !"".Equals(sUN002))
{
whereString += " and NW002 like ''%" + sUN002 + "%''";
}
//加入类型查询
if (Request["typeid"]!=null && !"".Equals(Request["typeid"]))
{
string type = Request["typeid"].ToString();
whereString += "and NW005 =" + type + "";
}
if (null != sNewsType && !"".Equals(sNewsType))
{
whereString += "and NW005 =" + sNewsType + "";
}
//绑定datalist数据
this.DataListNews.DataSource = new OA_NEWS_MANAGE_ACTION().GetDataSource(this.AspNetPagerNews.CurrentPageIndex, this.AspNetPagerNews.PageSize, whereString);
//设置主键
this.DataListNews.DataKeyField = "NW001";
//绑定
this.DataListNews.DataBind();
//设置分页控件的记录总数
this.AspNetPagerNews.RecordCount = this.GetRecordCounts(whereString);
} --------------------编程问答-------------------- 绑定如何空值??
--------------------编程问答-------------------- 我表达能力太差了,呜呜.自已解决鸟
补充:.NET技术 , ASP.NET