Posting value from one page to another
-
Hello friends, I want to post one value from one form to another ..I added that value to session and tried to get the session value. I got the value in another page and assigned it to textbox control. but the textbox did not display it. If i refresh the page again textbox display the value? Is there any other solution for posting value from one page to other? Thanks
-
Hello friends, I want to post one value from one form to another ..I added that value to session and tried to get the session value. I got the value in another page and assigned it to textbox control. but the textbox did not display it. If i refresh the page again textbox display the value? Is there any other solution for posting value from one page to other? Thanks
How did you assigned the value to the textbox control, and most important when (where in your code)? Please provide the snippet of your code where you assign the value to the control.
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
How did you assigned the value to the textbox control, and most important when (where in your code)? Please provide the snippet of your code where you assign the value to the control.
It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
Thanks for reply.. protected void Page_Load(object sender, EventArgs e) { if (Session["test"] == null) { } else { Text1.Value = Convert.ToString(Session["test"]); TextBox1.Text = Convert.ToString(Session["test"]); } } This is how i assigned the values? is there any other way?
-
Hello friends, I want to post one value from one form to another ..I added that value to session and tried to get the session value. I got the value in another page and assigned it to textbox control. but the textbox did not display it. If i refresh the page again textbox display the value? Is there any other solution for posting value from one page to other? Thanks
-
Thanks for reply.. protected void Page_Load(object sender, EventArgs e) { if (Session["test"] == null) { } else { Text1.Value = Convert.ToString(Session["test"]); TextBox1.Text = Convert.ToString(Session["test"]); } } This is how i assigned the values? is there any other way?
Hmmm, seems quite right to me. Maybe you should check for a postback before:
protected void Page_Load(object sender, EventArgs e)
{
if(!this.IsPostBack)) {
if (Session["test"] == null)
{ }
else
{Text1.Value = Convert.ToString(Session\["test"\]); TextBox1.Text = Convert.ToString(Session\["test"\]); }
}
}It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
Hello friends, I want to post one value from one form to another ..I added that value to session and tried to get the session value. I got the value in another page and assigned it to textbox control. but the textbox did not display it. If i refresh the page again textbox display the value? Is there any other solution for posting value from one page to other? Thanks
-
Do one thing take the Session value in variable first and then test with break points. I think your if condition is not working correctly.
-
Hi, you can try this in your webform1 session("id")= textbox1.text in your webform2 textbox2.text = session("id") Hope this one can help. Thanks
yes i have already written this code. protected void Page_Load(object sender, EventArgs e) { if(!this.IsPostBack)) { if (Session["test"] == null) { } else { Text1.Value = Convert.ToString(Session["test"]); TextBox1.Text = Convert.ToString(Session["test"]); } } } but not working..The value is assigned to the textbox but not displayed until postback occurs.
-
Hmmm, seems quite right to me. Maybe you should check for a postback before:
protected void Page_Load(object sender, EventArgs e)
{
if(!this.IsPostBack)) {
if (Session["test"] == null)
{ }
else
{Text1.Value = Convert.ToString(Session\["test"\]); TextBox1.Text = Convert.ToString(Session\["test"\]); }
}
}It's not a bug, it's a feature! Check out my CodeProject article Permission-by-aspect. Me in Softwareland.
-
Thanks..I debug the code the value is getting assigned to the textbox correctly..but not displaying..may be viewstate is not refreshed. Is there any solution for this?