Menu

#102 PostBack not working

open
nobody
None
5
2006-01-11
2006-01-11
tom
No

Hi,

I as trying to change the selected index of a drop down
list. The relevant pieces of code are shown below.

DropDownListTester CustomerList;

CustomerList = new DropDownListTester("CustomerList",
CurrentWebForm);

CustomerList.SelectedIndex = CustomerList.Items.Count -
1; // Selects last customer in list

The CustomerList is set to AutoPostBack

My problem is that the CustomeList.SelectedIndex
remains 0, even though the CustomerList.Items.Count - 1
evaluates to 10.

I have a feeling that the page is not posting back and
so have tried to use the PostBack() method of the
ControlTester, but I can't fugure out how to use this.

Please advise.

Bryan

Discussion

  • Nobody/Anonymous

    Logged In: NO

    I am having the exact problem. I think the autopostback is
    not working.
    I also created a class and that inherited the ControlTester
    abstract class and called the PostBack method. I am getting
    errors.
    Since I am new NUnitAsp Can somebody help out here?
    A simple working example would surely help.
    Thanks.

    Programmer.

     
  • JonathanClarke

    JonathanClarke - 2006-06-12

    Logged In: YES
    user_id=1446915

    This worked for me.
    http://www.bitwix.com/Floyd/AutoPostBack.aspx is a page
    which shows the test I used and the form on which I used it.

     

Log in to post a comment.