Property

S

shapper

Hello,

I have a page with 2 web controls. WC2 is inside WC1 as follows:

Page

|---- WC1

|------ WC2

On WC1 I have a GridView.

I need to access a value in WC2 which is defined on the GridView
RowEditing event in WC1.

So what I did was:

1. Create a property in WC2 named "MyVal"

2. On my WC1 GridView RowEditing event I defined WC2.MyVal = "Test"

I added on WC2 Load event the code Response.Write(Me.MyVal). I get
nothing.

What am I doing wrong?

Thanks,

Miguel
 
E

Elroyskimms

I have a page with 2 web controls. WC2 is inside WC1 as follows:

Page

|---- WC1

|------ WC2

On WC1 I have a GridView.

I need to access a value in WC2 which is defined on the GridView
RowEditing event in WC1.

So what I did was:

1. Create a property in WC2 named "MyVal"

2. On my WC1 GridView RowEditing event I defined WC2.MyVal = "Test"

I added on WC2 Load event the code Response.Write(Me.MyVal). I get
nothing.


It sounds like you may be doing this in the wrong order. When you
click to edit the GridView, the postback will first run the Load event
handlers for WC1 and WC2. The last thing to be run is the WC2
RowEditing event handler. So, at the time of WC2.Load, the Edit event
code has not been executed, so the value has not been set. The WC2
code which uses the property MyVal needs to be called after the
RowEditing event in WC1. If you put it in its own method, you could
call it:

'Inside the WC1 RowEditing event
WC2.MyVal="Test"
WC2.MyFunctionName()

This will run the function in WC2 after the MyVal has been set.

HTH,

-E
 

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,743
Messages
2,569,478
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top