列表中每行有多个下拉框,在后台databound中调用前台的脚本函数,传行索引,前台接收索引获取指定行的特定下拉框,并取值,代码如下:
后台:
protected void lpgProductList_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
<pre class="html" name="code"> int index = e.Row.RowIndex;
<pre class="html" name="code"> ImageButton imgViewProduct = (ImageButton)e.Row.FindControl("lbtnViewProduct");
ImageButton imgEditProduct = (ImageButton)e.Row.FindControl("lbtnEditProduct");
imgViewProduct.Attributes.Add("onclick", string.Format("