这里的Id,就是本行数据的Id值,怎么把这个值传给后台绑定数据源的参数中?

后台C#
public SqlDataReader defaultSelectedDDLDS(string Id)
    {
        DAL.dbFunctions db = new DAL.dbFunctions();
        Int32 id = Convert.ToInt32(Id);
        return db.returnReader("select * from [yy8_systemSelectorOptions] where selectorId=" + Id, null);
    }
------解决方案--------------------------------------------------------
建议你用隐藏控件Session保存值,然后defaultSelectedDDLDS不需要传参,直接使用隐藏控件或session的值
------解决方案--------------------------------------------------------
GridView中加DataKeyNames="ID"
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
    {
        if (e.Row.RowType == DataControlRowType.DataRow)
        {
            DropDownList ddl = (DropDownList)e.Row.FindControl("ddl的id");
 DAL.dbFunctions db = new DAL.dbFunctions();
        Int32 id = Convert.ToInt32(e.Row.RowIndex);
        return db.returnReader("select * from [yy8_systemSelectorOptions] where selectorId=" + id, null);
ddl.DataSource = ;
ddl.DataValueField = ;
ddl.DataTextField = ;
ddl.DataBind();
        }
    }
------解决方案--------------------------------------------------------
把函数的实现写到DropDownList的selectchange事件中,换个思路试试。
查看全文
  相关解决方案