Controls Postback --- Please help urgent

V

Vishwanathan Raman

I have two controls

Control A has a text box and button
Control B has a text box

Both these controls are pasted on custompage.aspx. When I click on button on
Control A I do some processing and then input this information to Control B.

I am able to achieve this but there is some issue. custompage.aspx has some
logic that is done after Control A does some processing which is the input to
Control B.

I find that I am unable to achieve this.I blv the click code in Control A
should be processed before the custompage.aspx postback begins.

Can anybody throw some insights.

Vishwanathan
 
B

beanweed

I am not sure I understand completely, but I think I have had a similar
problem. I wanted a contol event to finishing processing, including calling
other methods, before using the results to affect a different control that
would be displayed.

My suggestion is to (re)read the control execution lifecycle
(http://msdn.microsoft.com/library/d...guide/html/cpconcontrolexecutionlifecycle.asp).
You might see in there where you want your processing to happen. In my case,
I overrode the OnPreRender event to change the display characteristics of
some controls after a click event on a different control.
 
V

Vishwanathan Raman

Hi

This is what I want to achieve

CustomPage.aspx has two user controls

Control A
a)Text Box
b)Button
c)TextProperty

When you click button TextProperty is set to some value+text box content

Control B
a)Text Box

This is what happens

When you click on button of Control A, custompage.aspx get posted back. In
the page load event if I access Control A.TextProperty I get an error since
its not set.

It gets set only at the end of the Load event.

This Control A.TextProperty is input to Control B.

Please let me know if you understand my problem.

Regards
Vishwanathan
 
B

beanweed

Your A.Button_Click event is processed during the "Handle Postback Events"
stage (after Page Load). So if you want to change a property of control B to
some value set during that stage you will have to handle it in some later or
concurrent event. Did you try setting B.TextBox.Text in the event handler for
A.Button_Click?

Private Sub A.Button_Click(...
....
A.TextProperty = somevalue
B.TextBox.Text = A.TextProperty
End Sub

If that didn't work try overiding OnPreRender, e.g.

Protected Overrides Sub OnPreRender(ByVal e As EventArgs)
MyBase.OnPreRender(e)
B.TextBox.Text = A.Text_Property
End Sub

If that doesn't work you may have to write some sort of RaisePostbackEvent
handler (very messy). Good luck.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top