c# - Cross Page Posting not working -


i trying pass value of variable 1 page using cross page post-back using code:

on page1:

<asp:textbox id="changepwd" runat="server"></asp:textbox>  <asp:button id="changepassword" runat="server" text="change password"   postbackurl="~/page2.aspx" /> 

i have assigned value @ runtime database in cs file as: changepwd.text = dataset.tables[0].rows[0]["emppassword"].tostring();

on page 2: in page load event:

protected void page_load(object sender, eventargs e)     {         if (previouspage != null && previouspage.iscrosspagepostback)         {             textbox txt = (textbox)previouspage.findcontrol("changepwd");             textbox1.text = txt.text;         }     } 

but don't value previous page. getting value null. on page1 getting value correctly database not being passed onto page 2. can please tell me why?

hope helping u:

page 1:

<asp:textbox id="changepwd" runat="server"></asp:textbox>  <asp:button id="btnchangepassword" runat="server" text="change password"   postbackurl="~/page2.aspx" /> 

page 1 behind code:

public textbox changepassword {         {         return changepwd;     } } 

page 2: define @ page header:

<%@ previouspagetype virtualpath="~/page1.aspx" %> 

page 2 behind code:

protected void page_load(object sender, eventargs e) {     if (page.previouspage != null && previouspage.iscrosspagepostback == true)     {         textbox1.text = previouspage.changepassword.text;     } } 

Comments

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -