URL Refresh Problem on .NET aspx page


G

Guest

Hi all,

I have an aspx page that opens with some parameter (mypage.aspx?idclient=1).
Next, I have a dropdown list on this page that lets select the new value of
parameter idclient. Than I just want to reload the same page with the new
parameter:

response.redirect(mypage.aspx?idclient=" +
mydropdownlist.SelectedValue.ToString)

that makes refresh the page avec "?idclient=2" (for exemple)

Everything is going well, except a little thing: in the URL address of t he
page it is steel shown the old address with old value of parameter idclient
("mypage.aspx?idclient=1"). That means if user clicks on internet explorer
"Refresh button" the page will be re-generated with an old parameter!

Could you advise me how could I change not only the page but also the URL
address to be corresponding to new parameter value?

Thank you very much in advance for code exemple,

Anna
 
Ad

Advertisements

O

Olaf Rabbachin

Hi,

Anna said:
I have an aspx page that opens with some parameter (mypage.aspx?idclient=1).
Next, I have a dropdown list on this page that lets select the new value of
parameter idclient. Than I just want to reload the same page with the new
parameter:

response.redirect(mypage.aspx?idclient=" +
mydropdownlist.SelectedValue.ToString)

that makes refresh the page avec "?idclient=2" (for exemple)

Everything is going well, except a little thing: in the URL address of t he
page it is steel shown the old address with old value of parameter idclient
("mypage.aspx?idclient=1"). That means if user clicks on internet explorer
"Refresh button" the page will be re-generated with an old parameter!

Could you advise me how could I change not only the page but also the URL
address to be corresponding to new parameter value?

you'll need to set your DropDownList's ViewState-property to <False>.

Cheers,
Olaf
 
G

Guest

Thank you for response, but it does not solve the problem : the
SelectedIndexChanged event is not even raised for dropdownlist ...
 
O

Olaf Rabbachin

Salut Anna,

Anna said:
Thank you for response, but it does not solve the problem : the
SelectedIndexChanged event is not even raised for dropdownlist ...

did you set the DDL's AutoPostback-property to <True>? I repro'ed your
scenario here and it worked like a charm, but the forementioned property
will have to be set as well in order for the control to fire its
SelectedIndexChanged-event right away.
That is, a page that will load its data according to an ID that's being
taken from the QueryString while the DDL on that same page itself causes
the page to reload using the SelectedValue-portion of the DDL, passed on by
means of the QueryString again. Does that reflect your scenario ..?

Cheers,
Olaf
 
Ad

Advertisements

G

Guest

Hi Olaf,

Thank you very much of thinking about my problem.

The "AutoPostback" property was set to true... You are right as for
scenario, but
meanwhile I understood the reason of the problem : that comes from
"response.redirect" method. So, it redirects without refershing of url of
page. Then I replaced this method with the javascript that just recall the
same page as follows :

MyJavascript = "<script language=JavaScript>top.location=" & """" &
"frameset.aspx?idclient=" & mydropdownlilst.SelectedValue.ToString
& "&client=" & mydropdownlist.SelectedItem.Text &
"&contentpage=blank.htm" & """" & "</script>"

Than the javascript is executing as follows :

If (Not IsClientScriptBlockRegistered("clientScript")) Then
Page.RegisterStartupScript("clientScript", MyJavascript)
End If

And that just works..


Best Regards,

Anna
 

Top