开发者

change control from different page

page1

<input type="text" runat="server" id="text1"/>

page2

when page2 Load in This Method

protected void btna_Click1(object sender, EventArgs e)
{
     text1.text="test";
}

how change control in page1 from page2 method btna_Click1

or

HTML

 <input type="text" runat="server" id="text1"/>

Code

cl开发者_JAVA百科ass test2
{
    public void changeText(control cnt)
    {
     cnt.text="test";
    }
}

protected void btna_Click1(object sender, EventArgs e)
{
    test2 t=new test2();

     test2.changeText(text1)
}

I want the test1 is on page1 in the modified method btna_Click1 on page 2


In Your situation I weel be use Query Strings More info here

Your page object have life cycle between Begin Request and End Requests Begin Request -> Create PageObject -> do all events (function in page and control) -> Rendering Html -> destroy pageObject -> End Request

You may keep util information (objects) on ViewState (More info here) or Session (More info here) for passing it between pages


Did you know that Page has a property named "PreviousPage" ? :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜