这是我的问题。假设通过示例,当我点击转发器行ID时,它将转移到特定客户发票。
但是在客户发票页面中,它仅在客户Id登录时打开。所以这里有两个不同的页面访问一个页面数据。我的代码如下。 在转发器的页面中。
<th>
<asp:LinkButton ID ="lnkbtnStmt" Text ="Statement" OnClick ="lnkbtnStmt_Click" runat="server"></asp:LinkButton>
<asp:HiddenField ID ="hfStmt" runat ="server" Value='<% #Eval("No")%>'/>
</th>
在repeater .cs页面中:
public void lnkbtnStmt_Click(object sender, EventArgs e)
{
int rptIndex = ((RepeaterItem)((LinkButton)sender).NamingContainer).ItemIndex;
string hfItem = Convert.ToString(((HiddenField)RptEmpCustInvoise.Items[rptIndex].FindControl("hfStmt")).Value);
Customer_Ledger_Entries custlist = new Customer_Ledger_Entries();
List<Customer_Ledger_Entries_Filter> cFilter = new List<Customer_Ledger_Entries_Filter>();
Customer_Ledger_Entries_Filter cfield = new Customer_Ledger_Entries_Filter();
cfield.Field = Customer_Ledger_Entries_Fields.Customer_No;
cfield.Criteria = hfItem;
cFilter.Add(cfield);
Customer_Ledger_Entries[] culist = cls.wsCustInvoice.ReadMultiple(cFilter.ToArray(), null, 1);
if (culist.Length > 0)
{
Response.Redirect("frmCustomerInvoice.aspx?Customer_No=" + hfItem);
}
}
在另一个客户页面中。
protected void Page_Load(object sender, EventArgs e)
{
try
{
if (!IsPostBack)
{
GetOpeningBal();
bindCustInvoice(objSession.getSession(HttpContext.Current, "NonEmpCode"));
string empCustId = Request.QueryString["Customer_No"];
if (empCustId.Length != 0)
{
CustInvoice("empCustId");
}
GetClosingBal();
}
}
catch (Exception ex)
{
ScriptManager.RegisterStartupScript(this.Page, this.GetType(), string.Empty, "alert('" + ex.Message.ToString() + "');", true);
}
}
在此页面中,bindCustInvoice()
方法在客户登录时有效,CustInvoice("empCustId");
方法在我们点击转发器ID时有效。
任何人都可以给我解决方案吗?
答案 0 :(得分:1)
单击Repeater Id时,尝试从查询字符串发送页面名称。并检查另一个客户页面中的页面名称
伪码
string PageName ="";
if(Request.QueryString["PageName"] != null)
{
PageName= Request.QueryString["PageName"];
}
if(PageName != "")
{
string empCustId = Request.QueryString["Customer_No"];
if (empCustId.Length != 0)
{
CustInvoice("empCustId");
}
}
else{
bindCustInvoice(objSession.getSession(HttpContext.Current, "NonEmpCode"));
}