获取GridView两列值作为删除条件,但是实现不了,求助高手
获取GridView两列值作为删除条件,但是实现不了,求助高手
提示错误
<asp:TemplateField HeaderText="条目类型">
<ItemTemplate>
<%# Eval("ConName")%>
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID='TBPTY' Text='<%#Eval("ConName")%>' runat='server'/>
</EditItemTemplate>
<ItemStyle Width="150px" />
</asp:TemplateField>
后台cs
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
string id = GridView1.DataKeys[e.RowIndex].Values[0].ToString();
//string conName = GridView1.Rows[e.RowIndex].Cells[1].Text;
string conName = ((Label)GridView1.Rows[e.RowIndex].FindControl("TBPTY")).Text;
SqlParameter[] pras = { User1.ParamBuilder("ConName", conName, SqlDbType.Char) };
SqlDataReader sdr = User1.returnsdr1("select_conName", pras);
if (sdr.Read())
{
int type = Convert.ToInt32(sdr[0]);
SqlParameter[] pras2 = { User1.ParamBuilder("UserID", Convert.ToInt32(id), SqlDbType.Char), User1.ParamBuilder("Type", type, SqlDbType.Int) };
if (User1.delUser("del_userDetail",pras2))
{