Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

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

1 view
Skip to first unread message

COHEN...@lycos.com

unread,
May 8, 2008, 11:26:08 AM5/8/08
to
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

bruce barker

unread,
May 8, 2008, 11:41:06 AM5/8/08
to
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)

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

unread,
May 10, 2008, 2:13:41 AM5/10/08
to
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

<COHEN...@lycos.com> wrote in message
news:2320682a-19bb-4fa5...@k37g2000hsf.googlegroups.com...

0 new messages