首先,在前臺頁面上放置壹個LinkButton。
& ltASP:link button ID = " lbtnNull " runat = " server " Text = " Null "
onclick = " lbtnNull _ Click " Visible = " false " & gt。& lt/ASP:link button & gt;
背景事件如下
受保護的void lbtnNull_Click(對象發送方,事件參數e)
{
d _ Bind _ P();
gvData _ P . Visible = true
}
簡單點。下面是D_Bind_P()的代碼
受保護的void D_Bind_P()
{
strMate_No =請求。QueryString["mate"]。ToString()。trim();
string strTb _ Nm = null
string s = ddlBrand。SelectedValue.ToString()。trim();
開關(ddlBrand。選定值)
{
案例“v_LOGO_HondaOutin_MaterialMst”:
strTb _ Nm = " v _ LOGO _ Product _ Mst
打破;
案例“LOGO _ hzr _ Honda _ outin _ material _ MST”:
strTb _ Nm = " LOGO _ HondaOutin _ BOM _ MST _ DTL _ Tb ";
打破;
案例“LOGO _ hzr _ Nissan _ outin _ material _ MST”:
strTb _ Nm = " LOGO _ NissanOutin _ BOM _ MST _ DTL _ Tb ";
打破;
}
if (rbtnUN_Confirm。選中==真)
{
//待確認的按鈕
strSql = "select product_no,cusdesch_c1,cusdesch_c2,int desch _ c ";
strSql += " from " + strTb_Nm +"其中rtrim(ltrim(product _ no))+";
strSql+= " rtrim(ltrim(cusdesch _ c 1))+rtrim(ltrim(cusdesch _ C2))+rtrim(ltrim(intdesch _ c))not in ";
strSql+= "(select rtrim(ltrim(Product _ no))+rtrim(ltrim(Cusdesch _ c 1))+rtrim(ltrim(Cusdesch _ C2))+";
strSql+= " rtrim(ltrim(int desch _ c))from LOGO _ product reveal _ Tb ";
strSql += "和material _ No = ' "+strMate _ No+" ' ";
if (dc.gvBind(strSql," 0 ",gvData_P) == false)
{
公元前。MsgBox("產品列表加載失敗");
返回;
}
gvData4。可見=假;
gvData _ P . Visible = true
}
if (rbtnConfirm。選中==真)
{
//確認按鈕
//不要在意商標類型。
strTb _ Nm = " LOGO _ product reveal _ Tb ";
strSql = "select Product_no,Cusdesch_c1,Cusdesch_c2,Intdesch_c,Reveal _ Flg from "+strTb _ Nm+" where ";
strSql+= " Material _ No = ' "+str mate _ No+" ' ";
if (dc.gvBind(strSql," 0 ",gvData4) == false)
{
公元前。MsgBox("產品列表加載失敗");
返回;
}
gvData _ P . Visible = false
gvData4。可見=真;
}
}
最後,我順便把gridview前臺代碼發給妳。
& ltASP:GridView ID = " gv data _ M " runat = " server " back color = " White "
border color = " # cc 9966 " border style = " None " border width = " 1px " cell padding = " 4 "
autogenerate columns = " false " Width = " 450 px " allow page = " True " onpageindexchanging = " gv data _ M _ PageIndexChanging "
onrowcancelingedit = " gv data _ M _ RowCancelingEdit "
onrowediting = " gv data _ M _ RowEditing " onrowupdating = " gv data _ M _ row updating " & gt;
& ltrow style back color = " White " ForeColor = " # 330099 " Font-Size = " 10px "/& gt;
& ltfooter style back color = " # FFFFCC " ForeColor = " # 330099 "/& gt;
& ltpage style back color = " # FFFFCC " ForeColor = " # 330099 " horizontal align = " Center "/& gt;
& ltSelectedRowStyle back color = " # ffcc 66 " Font-Bold = " True " ForeColor = " # 663399 "/& gt;
& ltheader style back color = " # 90ee 90 " Font-Bold = " True " ForeColor = " Black " Font-Size = " 10px "/& gt;
& lt列& gt
& ltASP:TemplateField header text = " Part number " item style-horizontal align = " left " >
& ltItemTemplate & gt
& ltASP:link button ID = " lbtnMate _ No " runat = " server " Text = ' & lt;% # Eval(" material _ no ")% & gt;'OnClick="lbtnNull_Click "
PostBackUrl = ' & lt%#字符串。格式(" ~/Asp _ Form/frm _ logo reveal _ m . aspx?mate={0} ",Eval(" material _ no ")% & gt;'& gt& lt/ASP:link button & gt;
& lt/item template & gt;
& lt/ASP:TemplateField & gt;
& ltASP:TemplateField header text = " part name " item style-horizontal align = " left " >
& ltItemTemplate & gt
& ltASP:Label ID = " LBL mate _ Nm " runat = " server " Text = ' & lt;% # Eval(" material _ nm ")% & gt;'& gt& lt/ASP:Label & gt;
& lt/item template & gt;
& lt/ASP:TemplateField & gt;
& ltAsp:TemplateField HeaderText= "通關名稱" item style-horizontal align = " left " >
& ltItemTemplate & gt
& ltASP:Label ID = " lblRmks " runat = " server " Text = ' & lt;% # Eval(" rmks ")% & gt;'& gt& lt/ASP:Label & gt;
& lt/item template & gt;
& lt/ASP:TemplateField & gt;
& ltASP:TemplateField header text = " Is it exposed " >
& ltEditItemTemplate & gt
& ltASP:CheckBox ID = " CBK reveal " runat = " server "/& gt;
& lt/edit item template & gt;
& ltItemTemplate & gt
& ltASP:Label ID = " LBL reveal " runat = " server " & gt;& lt/ASP:Label & gt;
& lt/item template & gt;
& lt/ASP:TemplateField & gt;
& ltAsp:TemplateField HeaderText= "材料輸入時間"項目樣式-horizontal align = "left " >
& ltItemTemplate & gt
& ltASP:Label ID = " lblDt " runat = " server " Text = ' & lt;% # Eval(" upd _ dt ")% & gt;'& gt& lt/ASP:Label & gt;
& lt/item template & gt;
& lt/ASP:TemplateField & gt;
& ltASP:TemplateField show header = " false " item style-Width = " 80px " & gt;
& ltEditItemTemplate & gt
& ltASP:link button ID = " lbtnUpdate " runat = " server " causes validation = " true "
command name = " Update " Text = " Update " > & lt;/ASP:link button & gt;
& ltASP:link button ID = " lbtnCancel " runat = " server " causes validation = " false "
command name = " Cancel " Text = " Cancel " > & lt;/ASP:link button & gt;
& lt/edit item template & gt;
& ltItemTemplate & gt
& ltASP:link button ID = " lbt edit " runat = " server " causes validation = " false "
command name = " Edit " Text = " Edit " > & lt;/ASP:link button & gt;
& lt/item template & gt;
& ltItemStyle Width = " 80px " & gt& lt/ItemStyle >
& lt/ASP:TemplateField & gt;
& lt/Columns & gt;
& lt/ASP:GridView & gt;