0

I have a problem,, I have to stop one Loading class on button click. I already checked some forums related to this. But didnt find exact solution.

for example:

Public Sub LoadDropDown()
            Dim it As Integer
            For it = 0 To 1000000
                DropDownList1.Items.Add(it)
            Next
End Sub

I have to load the drop down on Load button click, and have to cancel that on cancel button click

Help me.

Thank You

Rajs

Edited by __avd: Added [code] tags.

5
Contributors
5
Replies
6
Views
5 Years
Discussion Span
Last Post by omar isaid
0

Hi,

Not sure what you mean

sub CancelButtononclick()
Mydropdownlist.items.clear
Mydropdownlist.visible =false
end sub

sub loadbuttonClick()
Dim it As Integer
For it = 0 To 1000000
DropDownList1.Items.Add(it)
Next
ENd Sub
0

Waddell,

But the cancel button event will work only after completing the load button event. So it will continue the loop

0
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
 {
  call ur function here
 }
}

Edited by __avd: Added [code] tags.

0

Just call the function your want to run when page load in post back..
i.e:

 if (Page.IsPostBack == false)
        {
            // Function name
        }

or if you call it when it run after page load then

        if (Page.IsPostBack == true)
        {
            // function name
        }

Just make then code in button click a function and call it as you require

Edited by pyTony: fixed formatting

0

You can use the ViewState to indicates when you the page can load the drop down list and when shall not fill the drop down list
The set of the value of ViewState can be on the buttons click events of the buttons at your application

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.