C#, ASP.Net -- Autopostback not autoposting back

Posted on 2003-03-31
Medium Priority
Last Modified: 2008-03-03
Hi all.

I have a web form using aspnet controls. It works fine for my submit button. I have 3 check box controls which i have set to autopostback, however, then I check and un-check them, it does nothing.  I'm still pretty new at this stuff, so I might be missing something obvious. I have checked my main page and don't see anything preventing it.  When I looka the rendered HTML, I don't see anything in the HTML that would cause the Checkbox to post back to the server.

Anybody got any ideas? Its a real straight forward form.

Here is sample of the HTML code in the VS.Net(pre-rendered)
      <asp:checkbox id="chkBoxDelete" style="Z-INDEX: 102; LEFT: 296px; POSITION: absolute; TOP: 18px" runat="server" width="173px" height="25" text="Delete Group(s)" tabindex="3" autopostback="True"></asp:checkbox>

Here is the Rendered HTML

      <span style="height:25px;width:173px;Z-INDEX: 102; LEFT: 296px; POSITION: absolute; TOP: 18px"><input id="chkBoxDelete" type="checkbox" name="chkBoxDelete" /><label for="chkBoxDelete">Delete Group(s)</label></span>

thanks in advance.
Question by:SegFault
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
  • 3
LVL 28

Expert Comment

ID: 8239617
If you set AutoPostBAck to true it must refrech the state of checkbox. The only thing that I can see might happen is that you init control in the Page_load eevnt where you have something like

If Page.IsPostBack then...
after that you are init the check box

It might cause that Autopostback will not fire.

Try to change the place wher you bind controls

Author Comment

ID: 8239687
I think I understand what you are saying. The problem is, that the page is not even posting if you click the check box. So it never makes it back to the server to re-init or re-fetch the state of the checkbox.

I would have thought that the .Net Web Controls would have added some JScript or something to cause the form to submit itself in the click event of the check box. However, I don't see anything.

Do I have a misconception on how the Autopostback stuff works?

LVL 28

Expert Comment

ID: 8239762
Add CheckBoxList, set the AutoPostback property to true and try the following code

 Private Sub cblContinents_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles cblContinents.SelectedIndexChanged
        Dim li As ListItem, msg As String
        ' check the Selected property of each item
        For Each li In cblContinents.Items
            If li.Selected Then
                msg &= String.Format("Item = {0}, Value = {1}<br>", li.Text, li.Value)
            End If
        lblCheckBoxListInfo.Text = msg
    End Sub
TCP/IP Network Protocol Cheat Sheet

TCP/IP is a set of network protocols which is best known for connecting the machines that make up the Internet. The truth is that TCP/IP is one of the oldest network protocols and its survival is mainly based on its simplicity and universality.


Author Comment

ID: 8239958
I'm not using a checkBoxList, I'm just using a regular checkbox.

The way its working on my setup though, even this won't work. I already have the events defined and wired up. But the HTML page is never posting back(ie calling form submit) when you click the check box.

very strange. I'll do some poking around with some of the other controls. see what they do.

LVL 28

Accepted Solution

iboutchkine earned 500 total points
ID: 8240116
I think checkBoxList behaves exactly like checkbox. I gave you this sample (it is running fine on my pc) to check that everything is alright with yours

Author Comment

ID: 8240143
i'll give it a shot. its probably a configuration thing on my server or something.
LVL 96

Expert Comment

by:Bob Learned
ID: 9725733
No comment has been added lately, so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area that this question is:

Answered by iboutchkine

Please leave any comments here within the next seven days.


EE Cleanup Volunteer

Featured Post

What is a Denial of Service (DoS)?

A DoS is a malicious attempt to prevent the normal operation of a computer system. You may frequently see the terms 'DDoS' (Distributed Denial of Service) and 'DoS' used interchangeably, but there are some subtle differences.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

IP addresses can be stored in a database in any of several ways.  These ways may vary based on the volume of the data.  I was dealing with quite a large amount of data for user authentication purpose, and needed a way to minimize the storage.   …
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
Suggested Courses

764 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question