I would like to better understand the issue of setting new parameters to a url
and retrieve it via
var ParaValue = Request.QueryString["parameterName"];
so if I have a URL : “http://www.myWebsite.aspx?UserName=Alice”
I will retrieve it via example above
string uName = Request.QueryString["UserName"].ToString();
but what if I want to alter value e.g. make UserName = “Ralf”
- Re Edit
when a button is pressed ,
there is a parameter “state” that holds a reference to wich button was pressed
the value of state was = “none”
now i want to set it to img_button1.
i am not even sending the actuall imgbutton id
i am hard coding it just for testing /referencing
so i could know i am in the stage of event reaquested by the procidure of the given event of
button1
when event triggerd by img_button2
i whould then want to set the state to “img_button2”
etc’
after I have made my research (I couldn’t mark any answer kindly given here on my post)
then I tested two options I’ve encountered in this Stack Overflow Page:
first option (given by Ahmad Mageed) I have tested to work just fine .
and readability was easy to understand (as I am still fresh to asp.net ‘tricks’)
then followed the answer by
annakata which was remarkably improved approach in the way that you
don’t actually have to redirect to achieve result – Query String IS modified
after playing around i have desided to follow annakatas approach
and make a helper method that was using also a redirerion option
with modified QueryString Parameters & values.
i find it very helpful to someone that has Considerably less experience with asp.net developmet
so i posted it as my version of correct answer , as i see it .
i hope it’ll help somoeone else that seeks the same Solution.
feel free to further improve it , as i mentiond I’m not a proven talent ..yet.