Gridview textbox has data check without postback.. javascript?



RE: Gridview textbox has data check without postback.. javascript?

I have a gridview with a textbox. I can set the textbox to
autopostback and check for a value in a prerender event to decide if I
should make a button on the grid row visible. However, the problem
with autopostback on a textbox is the postback occurrs when you select
another control or click away ( I guess). This is very awkward when
the control selected is dropdown as the page/selected control apears
to flicker and show and then retract the dropdownlist.

What's the best way to attack this? .. I want a button on my gridview
row to be visible when both a textbox and dropdown on the control
have data selected/entered. problem is, I don't want to turn
autopostback on the textbox since it behalves awkwardly when the next
control selected is a dropdown and that cause a postback before I can
even select a value.

Thanks in advance for any help or information.





bruce barker

you should always render the button but hide with style="display:none",
then in javascript via a onchange handler, check the value, then set the
style to block.

if you are going to do .net development, you should learn the w3c dom
and javascript. posting back to tweek the UI is very bad coding. some
will suggest using an update panel, but that is way overkill for this
and would be slow over the internet.

-- bruce (

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