cusoxty
06-16-2004, 08:56 AM
How do i go about disabling the submit button in ASP.net. I have an If Else statement, and I want the Submit button to be disabled upon the else command. Heres some code that should help you help me!
Sub Page_Load(sender As Object, e As EventArgs)
Dim rightNow as DateTime = DateTime.Now
If day(RightNow) > 14 Then
lbl_error.text = "You are not able to transfer accounts after the 25th of the month.
Please try again next month."
else
cmdInsert.enable = false
lbl_error.text = "Welcome to the Account Transfers Page. Please select an account and the
respective territories."
Dim sql as string
if not Page.IsPostBack then
sql = "select AccountID + ' - ' + AccountName as accnumber from Accounts order by
AccountName"
FillDropDownList(sql,AccNumber)
end if
if not Page.IsPostBack then
sql = "select distinct territoryName from Territories"
FillDropDownList(sql,Fromname)
end if
if not Page.IsPostBack then
sql = "select distinct territoryName from Territories"
FillDropDownList(sql,Toname)
end if
end if
End Sub
And here is my button
<asp:Button id="cmdInsert" name="cmdInsert"
onclick="cmdInsert_Click" runat="server" Text="Request Transfer" type="submit"></asp:Button>
Sub Page_Load(sender As Object, e As EventArgs)
Dim rightNow as DateTime = DateTime.Now
If day(RightNow) > 14 Then
lbl_error.text = "You are not able to transfer accounts after the 25th of the month.
Please try again next month."
else
cmdInsert.enable = false
lbl_error.text = "Welcome to the Account Transfers Page. Please select an account and the
respective territories."
Dim sql as string
if not Page.IsPostBack then
sql = "select AccountID + ' - ' + AccountName as accnumber from Accounts order by
AccountName"
FillDropDownList(sql,AccNumber)
end if
if not Page.IsPostBack then
sql = "select distinct territoryName from Territories"
FillDropDownList(sql,Fromname)
end if
if not Page.IsPostBack then
sql = "select distinct territoryName from Territories"
FillDropDownList(sql,Toname)
end if
end if
End Sub
And here is my button
<asp:Button id="cmdInsert" name="cmdInsert"
onclick="cmdInsert_Click" runat="server" Text="Request Transfer" type="submit"></asp:Button>