In Page 1, I have a link. When it is clicked, it should call the same page with different things, which i cannot do.
protected void lnkAddLoc_Click(object sender, EventArgs e)
{
MerchantId = CommonHelper.GetLoggedInMerchant();
string QueryStringValue2 = ApplicationData.URL_MERCHANT_PROFILE +
"?MerchantCompanyPayment";
Response.Redirect(QueryStringValue2);
}
So it calls Page 2. Page 2 has a button through which i can go to Page 1. Button Code is here.
protected void btnAdd_Click(object sender, ImageClickEventArgs e)
{
MerchantID = CommonHelper.GetLoggedInMerchant();
string QueryString = ApplicationData.URL_MERCHANT_COMPANY_PAYMENT +
"?MerchantProfilePages";
Response.Redirect(QueryString);
}
In the page load of Page 1, i want to call the button event handler.
if (string.Equals(QueryStringValue2, "MerchantCompanyPayment"))
{
btnAdd._________________________
}
Why don’t you move the redirect code out of the event handler and call it from two places. If I understand correctly, you want to automatically jump to page 2, process, then jump back to page 1. Don’t bother with the button click, just call the response.redirect directly. I may be missing the point here, and if so you may want to clarify what you’re asking…