If Dropdownlist has the AutoPostBack property is set to True
Automatically when the use selects an item in Dropdownlist SelectedValue Event is fired by default write your logic there.
If your Dropdownlist is an childcontrol for eg if it is within GridView. Then u have to set Autopostback at rowbound event or use javascript default function __doPostBack() which is present in every .aspx page
Please remember to click “Mark as Answer” on the post that helps you.
This can be beneficial to other community members reading the thread.
I need something like the Click method (that has WaitFor.Postback) to use with SetSelectedIndex, because SetSelectedIndex does not wait for the postback.
Currently WaitFor.Postback is only supported on the Click method. Supporting CommandParameters on the SetSelectedIndex and SetTextBox methods are a feature request that we are considering for the next release. Meanwhile, you can make use of the other wait
methods to block the execution of your test until the "autopostback" returns. Assuming that something in the UI of your page changes in response to the dropdown selection you can use one of the following:
<div mce_keep="true">WaitForAttributeValue (wait for an attribute on any element to be set to something)</div>
<div mce_keep="true">WaitForInnerText (wait for the inner text of any eleemnt to be set to something)</div>
<div mce_keep="true">WaitUntilNotFound (Wait until an element is no longer found on the page)</div>
pisoias
Member
26 Points
86 Posts
SetSelectedIndex for DropDownList with AutoPostBack
Mar 02, 2009 11:20 AM|LINK
Hello,
How can I wait for the postback when selecting an item in a DropDownList that has AutoPostBack ?
Thanksasifchouhan
Participant
1637 Points
298 Posts
Re: SetSelectedIndex for DropDownList with AutoPostBack
Mar 02, 2009 11:45 AM|LINK
Hi
I can't get your question wait for what?
If Dropdownlist has the AutoPostBack property is set to True
Automatically when the use selects an item in Dropdownlist SelectedValue Event is fired by default write your logic there.
If your Dropdownlist is an childcontrol for eg if it is within GridView. Then u have to set Autopostback at rowbound event or use javascript default function __doPostBack() which is present in every .aspx page
This can be beneficial to other community members reading the thread.
pisoias
Member
26 Points
86 Posts
Re: SetSelectedIndex for DropDownList with AutoPostBack
Mar 02, 2009 12:23 PM|LINK
Hello,
I need something like the Click method (that has WaitFor.Postback) to use with SetSelectedIndex, because SetSelectedIndex does not wait for the postback.
Thanks
farmas
Participant
1164 Points
259 Posts
Microsoft
Re: SetSelectedIndex for DropDownList with AutoPostBack
Mar 02, 2009 05:37 PM|LINK
Hello,
Currently WaitFor.Postback is only supported on the Click method. Supporting CommandParameters on the SetSelectedIndex and SetTextBox methods are a feature request that we are considering for the next release. Meanwhile, you can make use of the other wait methods to block the execution of your test until the "autopostback" returns. Assuming that something in the UI of your page changes in response to the dropdown selection you can use one of the following:
Hope if helps,
- Federico
pisoias
Member
26 Points
86 Posts
Re: SetSelectedIndex for DropDownList with AutoPostBack
Mar 07, 2009 02:13 PM|LINK
Ok thanks