UserControl in Template DataColumn

G

Guest

Hi
I developed a usercontrol with a textbox and an htmlInputHidden
When I add my usercontrol in a webform, it works properly
If I add my control in a template column of a datagrid i have some problems
When I load the webform, the usercontrol has a UniqueID like this: "LookUp1:txtRisultato", then I value the text of this textbox with a client-side script. If i post the page, the value saved in the textbox.text is null, but i see that the UniqueID is changed, and now is "DataGrid1:LookUp1:txtRisultato"
How can i refer to my usercontrol with an ID which doesn't changes
Why the UniqueID changes

P.S. I noticed that if I value the textbox sending the right ID (DataGrid1:LookUp1:txtRisultato) the post is made properl

Thank yo
Alessandro Rossi
 
M

Martin Dechev

Hi, Alessandro Rossi,

The UniqueID in this case receives its actual (and final) value after the
binding of the DataGrid. I suppose that you are reading it at some point
before that. That is why it has different value.

Hope this helps
Martin
Alessandro Rossi said:
Hi,
I developed a usercontrol with a textbox and an htmlInputHidden.
When I add my usercontrol in a webform, it works properly.
If I add my control in a template column of a datagrid i have some problems:
When I load the webform, the usercontrol has a UniqueID like this:
"LookUp1:txtRisultato", then I value the text of this textbox with a
client-side script. If i post the page, the value saved in the textbox.text
is null, but i see that the UniqueID is changed, and now is
"DataGrid1:LookUp1:txtRisultato".
How can i refer to my usercontrol with an ID which doesn't changes?
Why the UniqueID changes?

P.S. I noticed that if I value the textbox sending the right ID
(DataGrid1:LookUp1:txtRisultato) the post is made properly
 
G

Guest

No, I found the problem
I built the client-side script when the UniqueID wasn't complete (in the set method of a property). Now I moved the code in a Control PreRender event handler procedure's, and now all works properly

Thank you for the interest
Alessandro Rossi

----- Martin Dechev wrote: ----

Hi, Alessandro Rossi

The UniqueID in this case receives its actual (and final) value after th
binding of the DataGrid. I suppose that you are reading it at some poin
before that. That is why it has different value

Hope this help
Marti
Alessandro Rossi said:
Hi
I developed a usercontrol with a textbox and an htmlInputHidden
When I add my usercontrol in a webform, it works properly
If I add my control in a template column of a datagrid i have som problems
When I load the webform, the usercontrol has a UniqueID like this
"LookUp1:txtRisultato", then I value the text of this textbox with
client-side script. If i post the page, the value saved in the textbox.tex
is null, but i see that the UniqueID is changed, and now i
"DataGrid1:LookUp1:txtRisultato"
 
M

Martin Dechev

Hi, Alessandro Rossi,

The code in the PreRender method is executed *after* the binding of the
DataGrid. I was supposing (correctly) that you were reading the UniqueID
*before* the binding.

Anyway, it's good that you have resolved your problem.

Greetings
Martin
Alessandro Rossi said:
No, I found the problem.
I built the client-side script when the UniqueID wasn't complete (in the
set method of a property). Now I moved the code in a Control PreRender event
handler procedure's, and now all works properly.
 

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,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top