Show/Hide Textbox Conditionally -- Even if Postback Occurs

A

Aaron

I have a datagrid control that contains several columns of data (all
bound columns) and a TextBox in the last column (in an ItemTemplate).
If the text value of the second column in the datagrid is equal to
"EquiTrac" (without the quotes), I don't want to display the TextBox
in the last column. Otherwise, the TextBox should remain visible. In
other words, the TextBox will appear only in rows where "EquiTrac" is
not in the second column of that row.

After reading lots of posts on these forums, I have been able to get
this to work with either ItemDataBound or ItemCreated events, but not
both. Since, I have a validation routine running on the page, this
show/hide functionality has to work when the data is bound to the
TextBox and on a PostBack when validation error messages appear.

Any suggestions?

Thanks,
Aaron
 
E

Eliyahu Goldin

Aaron,

Try using PreRender event. In this event you are dealing with the page just
before rendering, it should not make any difference how the items got
populated.

Eliyahu
 

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,769
Messages
2,569,581
Members
45,056
Latest member
GlycogenSupporthealth

Latest Threads

Top