首先在前台页面放一个LinkButton
<asp:LinkButton ID="lbtnNull" runat="server" Text="Null"
onclick="lbtnNull_Click" Visible="false"></asp:LinkButton>
后台事件如下
protected void lbtnNull_Click(object sender, EventArgs e)
{
D_Bind_P();
gvData_PVisible = true;
}
简单吧。下面是D_Bind_P()的代码
protected void D_Bind_P()
{
strMate_No = RequestQueryString["mate"]ToString()Trim();
string strTb_Nm = null;
string s = ddlBrandSelectedValueToString()Trim();
switch (ddlBrandSelectedValue)
{
case "v_LOGO_HondaOutin_MaterialMst":
strTb_Nm = "v_LOGO_Product_Mst";
break;
case "LOGO_hzr_honda_outin_material_mst":
strTb_Nm = "LOGO_HondaOutin_bom_mst_dtl_Tb";
break;
case "LOGO_hzr_nissan_outin_material_mst":
strTb_Nm = "LOGO_NissanOutin_bom_mst_dtl_Tb";
break;
}
if (rbtnUN_ConfirmChecked == true)
{
//待确认按钮
strSql = "select product_no,cusdesch_c1,cusdesch_c2,intdesch_c ";
strSql += " from " + strTb_Nm + " where rtrim(ltrim(product_no))+";
strSql += "rtrim(ltrim(cusdesch_c1))+rtrim(ltrim(cusdesch_c2))+rtrim(ltrim(intdesch_c)) not in ";
strSql += "(select rtrim(ltrim(Product_no))+rtrim(ltrim(Cusdesch_c1))+rtrim(ltrim(Cusdesch_c2))+";
strSql += "rtrim(ltrim(Intdesch_c)) from LOGO_ProductReveal_Tb)";
strSql += " and material_no='" + strMate_No + "'";
if (dcgvBind(strSql, "0", gvData_P) == false)
{
bcMsgBox("品番清单加载不成功");
return;
}
gvData4Visible = false;
gvData_PVisible = true;
}
if (rbtnConfirmChecked == true)
{
//已确认按钮
//不需要理会商标类型
strTb_Nm = "LOGO_ProductReveal_Tb";
strSql = "select Product_no,Cusdesch_c1,Cusdesch_c2,Intdesch_c,Reveal_Flg from " + strTb_Nm + " where ";
strSql += "Material_no='" + strMate_No + "'";
if (dcgvBind(strSql, "0",gvData4) == false)
{
bcMsgBox("品番清单加载不成功");
return;
}
gvData_PVisible = false;
gvData4Visible = true;
}
}
最后顺便把gridview的前台代码发给你吧
<asp:GridView ID="gvData_M" runat="server" BackColor="White"
BorderColor="#CC9966" BorderStyle="None" BorderWidth="1px" CellPadding="4"
AutoGenerateColumns="false" Width="450px" AllowPaging="True" onpageindexchanging="gvData_M_PageIndexChanging"
onrowcancelingedit="gvData_M_RowCancelingEdit"
onrowediting="gvData_M_RowEditing" onrowupdating="gvData_M_RowUpdating">
<RowStyle BackColor="White" ForeColor="#330099" Font-Size="10px" />
<FooterStyle BackColor="#FFFFCC" ForeColor="#330099" />
<PagerStyle BackColor="#FFFFCC" ForeColor="#330099" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#FFCC66" Font-Bold="True" ForeColor="#663399" />
<HeaderStyle BackColor="#90EE90" Font-Bold="True" ForeColor="Black" Font-Size="10px" />
<Columns>
<asp:TemplateField HeaderText="部材编号" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:LinkButton ID="lbtnMate_No" runat="server" Text='<%# Eval("material_no") %>' OnClick="lbtnNull_Click"
PostBackUrl='<%# StringFormat("~/Asp_Form/frm_LogoReveal_Maspxmate={0}", Eval("material_no")) %>'></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="部材名称" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblMate_Nm" runat="server" Text='<%# Eval("material_nm") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="通关名称" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblRmks" runat="server" Text='<%# Eval("rmks") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="是否外露">
<EditItemTemplate>
<asp:CheckBox ID="cbkReveal" runat="server" />
</EditItemTemplate>
<ItemTemplate>
<asp:Label ID="lblReveal" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="部材录入时间" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="lblDt" runat="server" Text='<%# Eval("upd_dt") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ShowHeader="false" ItemStyle-Width="80px">
<EditItemTemplate>
<asp:LinkButton ID="lbtnUpdate" runat="server" CausesValidation="true"
CommandName="Update" Text="更新"></asp:LinkButton>
<asp:LinkButton ID="lbtnCancel" runat="server" CausesValidation="false"
CommandName="Cancel" Text="取消"></asp:LinkButton>
</EditItemTemplate>
<ItemTemplate>
<asp:LinkButton ID="lbtnEdit" runat="server" CausesValidation="false"
CommandName="Edit" Text="编辑"></asp:LinkButton>
</ItemTemplate>
<ItemStyle Width="80px"></ItemStyle>
</asp:TemplateField>
</Columns>
</asp:GridView>我以VB的过程说明一下:当你鼠标点击一个网页链接时,便会产生一个“点击”的事件,该事件是系统预先定义好的,只要这个网页(对象)发生了这个“点击”事件,便会触发下一行程序(过程),下一行便是一个超链接的地址,系统会自动识别
将a标签,绑定onclick事件,即可实现需要的功能。
具体HTML代码:
<a href="javascript:void(0)" onclick="chaXunCheCi(thisinnerHTML)">538路</a>代码解释:
onclick是对a标签进行点击事件绑定。
chaXunCheCi是原来的函数。
thisinnerHTML得到链接文字。
注意,如果链接中不是纯文本,而是有其他元素,建议改为thisinnerText稳妥一些。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)