ASP.net datalist,gridview 编辑模板里面控件的使用;

datalist:dropdownlist

int sum=0;
    foreach (DataListItem item in DataList1.Items)
    {

        DropDownList   ddl1   =   (DropDownList)item.FindControl("DropDownList1");
        sum   +=   Convert.ToInt32(ddl1.SelectedValue);
        //iSum   +=   Convert.ToInt32(ddl1.SelectedItem.Text);
    }

 

 

gridview:linkbutton,button,dropdownlist

string num = (((linkbutton)sender).SelectedValue.ToString()).ToString();

DropDownList ddl =((DropDownList)GRIDVIEW.Row(选择行的索引).cell(模版列所在列).findControl("控件ID"))
Id = ddl.Select.value
Text = ddl.SelectedItem.Text

你可能感兴趣的:(asp.net,button)