how does one limit postback to a small section of screen?

C

COHENMARVIN

I have a checkbox on my webpage which, if checked, should cause a
textbox to be enabled (or made visible). But I find I need to make
the checkbox have a autopostback of TRUE for this to work. Is there
any way, perhaps using Ajax update panels, to have a checkbox cause a
partial postback of only part of the page?
Thanks,
Marvin
 
B

bruce barker

this should be done in javascript, not ajax. no need to postback (may take a
couple seconds on the internet) just unhide or enable a control.

<script>
function setText(e)
{
var t= document.getElementById('<%=myTextbox.ClientID%>');
t.disabled = !e.checked;
}
</script>
<asp:checkbox id="chk" runat="server" onclick="setText(this);"/><br>
<asp:textbox id="myTextbox" runat="server" Enabled="false" />

-- bruce (sqlwork.com)
 
S

Steve C. Orr [MCSD, MVP, CSM, ASP Insider]

Bruce is right that you can do this more efficiently by using only client
side JavaScript.

You are also right that it could be done gracefully with an AJAX
UpdatePanel. This would be less efficient because it requires a round trip
to the server, but if you fear JavaScript then it would be the simpler
solution for you. If your app doesn't need to be optimized for scalability
then this solution would likely be sufficient.

--
I hope this helps,
Steve C. Orr,
MCSD, MVP, CSM, ASPInsider
http://SteveOrr.net
http://iPhonePlaza.net
 

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,900
Latest member
Nell636132

Latest Threads

Top