0

this question is duplicated of Is postback works only in pageload? I want to post back page when i have value in my query string. see code

if (Request.QueryString["HotelID"] != null)
// here i want to post back 
{

how i can post back page ?

Community
  • 1
  • 1
aami
  • 297
  • 2
  • 8
  • 20
  • `postback` or `redirect`? – शेखर Mar 21 '13 at 07:11
  • i want to postback page not redirect – aami Mar 21 '13 at 07:12
  • why do you want to postback on this condition? I don't think it is possible. There may be other way. you should explain what do you want after postback. – शेखर Mar 21 '13 at 07:12
  • @Shekhar i want to post back my page to call initialize culture..see this question for what i actually want... http://stackoverflow.com/questions/15515939/auto-post-back-property-not-working-with-tab-container – aami Mar 21 '13 at 07:20
  • @Shekhar i just want to do that when i click on edit button which is on another page then my first page on which query string value comes from edit button postback the page to true. – aami Mar 21 '13 at 07:59

2 Answers2

0

You can use this:

if (Request.QueryString["HotelID"] != null)
{
    Page_Load(sender, e);
}

Or this:

if (Request.QueryString["HotelID"] != null)
{
    Response.Redirect(Page.AppRelativeVirtualPath.ToString());
}

Hope it helps:)

Avishek
  • 1,896
  • 14
  • 33
0

try this;

if(!String.IsNullOrEmpty(Request.QueryString["HotelID"]))
{
     Response.Redirect(Request.UrlReferrer.ToString());
    or
     Response.Redirect("yourpagewithpath.aspx");
}
Idrees Khan
  • 7,702
  • 18
  • 63
  • 111