user609511
user609511

Reputation: 4261

how can i pass the querystring into aspx

i have url like this : DossierSoin_Fiche.aspx?SoinId=1

how can i pass this SoinId into dx:ASPxPopupControl

<dx:ASPxPopupControl ID="ASPxPopupControl_Surveill"
ContentUrl="~/PopUp/Surveillance.aspx?SoinId=<%=SoinId %>"
?

thanks you in advance

PS : i can not use code behinde, because it will reload the page, then i will lost the data that have not save in database. I use callback instead, so i need pass this querystring value on aspx not in aspx.cs

Upvotes: 0

Views: 1896

Answers (5)

Thousand
Thousand

Reputation: 6638

make a property "SoinID" (if you dont already have one)

protected string SoinId  {get;set;}

(type of modifier is up to the OP, could also be public).

then, assign a value to the property in your page_load:

SoinId = Request.QueryString["SoinID"];

your .aspx code can stay the same if you use it like this.

Upvotes: 1

Jaime Torres
Jaime Torres

Reputation: 10515

In your containers codebehind:

protected string SoinId
{
   get
   {
      return Request["SoinId"];
   }
}

And use the code you have.

Upvotes: 1

Tim B James
Tim B James

Reputation: 20364

I would imagine you could just assign the value in the code behind.

e.g.;

ASPxPopupControl_Surveill.ContentUrl = "~/PopUp/Surveillance.aspx?SoinId=" + Request["SoinId"].ToString();

Upvotes: 0

Yv&#225;n Ecarri
Yv&#225;n Ecarri

Reputation: 1739

Option A:

1) Declare a protected variable named SoinId in the scope of your aspx page.

2) In the Page_Load event, add this:

if(!Request.QueryString["SoinId"]==null)
{
   SoinId = Request.QueryString["SoinId"];
}

Opetion B:

Replace your aspx code with this:

<dx:ASPxPopupControl ID="ASPxPopupControl_Surveill" 
ContentUrl="~/PopUp/Surveillance.aspx?SoinId=<%=Request.QueryString["SoinId"] %>">

Edit: Consider using a property as other colleagues proposed. It's more ellegant.

Upvotes: 0

magnattic
magnattic

Reputation: 12988

Just pass the value to the public property in the CodeBehind of the page.

ASPxPopupControl_Surveill.ContentUrl = ...

[edit made with thanks to rs.]

Upvotes: 0

Related Questions