talker2004
asked on
ASP.NET how can i disable the dropdown list during postback's to the server.
I am trying to disable the dropdown list only during postback operations to the server. In this example the server sleeps for 5 seconds to simulate server processing. Ideally i would like to block the end user from making a new selection while the server is processing. The solution must work with ie6, ie7, and firefox.
Thanks in advance
Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load
If Not Page.IsPostBack Then
Me.cboService.Items.Clear( )
Me.cboService.Items.Add("H air Cut")
Me.cboService.Items.Add("M anicure")
Me.cboService.Items.Add("P erm")
End If
End Sub
Protected Sub cboService_SelectedIndexCh anged(ByVa l sender As Object, ByVal e As System.EventArgs)
System.Threading.Thread.Sl eep(5000)
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title runat="server" id="PageTitle">Default</ti tle>
<style type="text/css">
BODY {
background-color : #EACB9D;
font-family : Tahoma;
font-size : 9pt;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="lblMessage1" runat="server" ForeColor="Blue" Height="24px" Text="(1) Select a Service & Employee"
Width="312px" Font-Size="Medium" style="left: 8px; position: absolute; top: 120px"></asp:Label>
<asp:DropDownList ID="cboService" runat="server" Font-Size="Medium" Height="32px"
Width="312px" AutoPostBack="True" Font-Underline="False" style="position: absolute; left: 0px; top: 152px; z-index: 1;" OnSelectedIndexChanged="cb oService_S electedInd exChanged" >
<asp:ListItem>Hair Cut</asp:ListItem>
<asp:ListItem>Massage</asp :ListItem>
<asp:ListItem>Manicure</as p:ListItem >
</asp:DropDownList>
</form>
</body>
</html>
Thanks in advance
Here is the code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load, Me.Load
If Not Page.IsPostBack Then
Me.cboService.Items.Clear(
Me.cboService.Items.Add("H
Me.cboService.Items.Add("M
Me.cboService.Items.Add("P
End If
End Sub
Protected Sub cboService_SelectedIndexCh
System.Threading.Thread.Sl
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head id="Head1" runat="server">
<title runat="server" id="PageTitle">Default</ti
<style type="text/css">
BODY {
background-color : #EACB9D;
font-family : Tahoma;
font-size : 9pt;
}
</style>
</head>
<body>
<form id="form1" runat="server">
<asp:Label ID="lblMessage1" runat="server" ForeColor="Blue" Height="24px" Text="(1) Select a Service & Employee"
Width="312px" Font-Size="Medium" style="left: 8px; position: absolute; top: 120px"></asp:Label>
<asp:DropDownList ID="cboService" runat="server" Font-Size="Medium" Height="32px"
Width="312px" AutoPostBack="True" Font-Underline="False" style="position: absolute; left: 0px; top: 152px; z-index: 1;" OnSelectedIndexChanged="cb
<asp:ListItem>Hair Cut</asp:ListItem>
<asp:ListItem>Massage</asp
<asp:ListItem>Manicure</as
</asp:DropDownList>
</form>
</body>
</html>
<form id="form1" runat="server" onsubmit="document.getElem entById('c boService) .disabled = true;">
Sorry for the typo .
<form id="form1" runat="server" onsubmit="document.getElem entById('c boService' ).disabled = true;">
<form id="form1" runat="server" onsubmit="document.getElem
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.