日期:2014-05-18 浏览次数:20913 次
if (Request.QueryString["Rid"] != null) { string k = "0";//控制是否签收 DataSet ds = B_FileInfo1.GetList(" and a.id='" + Request.QueryString["Rid"] + "'"); if (ds.Tables[0].Rows[0]["ReadStatue"].ToString() != "") { string[] fread = ds.Tables[0].Rows[0]["ReadStatue"].ToString().TrimEnd(',').Split(','); for (int i = 0; i < fread.Length; i++) { if (fread[i] == Session["Townid"].ToString()) { k = "1"; 模板列显示“已签收”!! } } } if (k == "0") { bool falg = B_FileInfo1.UpdateRead(Session["Townid"].ToString() + ",", Request.QueryString["Rid"].ToString()); if (falg) { DBUtility.CRCommon.Show(this, "签收成功!"); } } }
<asp:TemplateField HeaderText="签收"> <EditItemTemplate> <asp:TextBox ID="TextBox4" runat="server"></asp:TextBox> </EditItemTemplate> <ItemTemplate> <a href='<%#"My.aspx?Rid="+Eval("id") %>'>签收</a> </ItemTemplate> </asp:TemplateField>
<ItemTemplate> <asp:Label ID="lab_ID" runat="server" Text='<%#GetOrganization(DataBinder.Eval(Container.DataItem, "OrganizationLevel").ToString(),DataBinder.Eval(Container.DataItem, "OrganizationID").ToString()) %>'></asp:Label> </ItemTemplate>
------解决方案--------------------
<ItemTemplate>
<a href='<%#"My.aspx?Rid="+Eval("id") %>'>签收</a>
</ItemTemplate>
这里换成LinkButton然后在gridview的行绑定事件里面
LinkButton lbtn = e.Row.FindControl("LinkButton1") as LinkButton;根据你的if条件赋值