Dear all,
I get problem with this ASP.Net form.
As you can see in the sources, I have Check Box (ChkAllCustomer), Combo Box (CmbDept) and Command Button (CmdLocateCustomer).
And to avoid postback I use JavaScript event instead of Anthem.Net.
Everytime user clicks ChkAllCustomer.Checked = true, CmdLocateCustomer enable property is set to false and CmbDept enable property is set to true.
In the other way, if ChkAllCustomer.Checked = false, CmdLocateCustomer enable property is set to true and CmbDept enable property is set to false.
Problem occurs when user clicks CmdLocateCustomer, but somehow CmdDept enable property is set to true manually where as there is not code in CmdLocateCustomer click event.
Please help me.
Thanks and regards,
Kusno.
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="RptLoan.aspx.vb" Inherits="RptLoan" EnableSessionState="True"%>
<%@ OutputCache Location="Client" duration="5" varybyparam="none" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Loan</title>
<script language="Javascript" type="text/javascript">
function ChkAllCustomerClick()
{
if(form1.ChkAllCustomer.checked == true)
{
form1.TxtCustomerId.value = "";
form1.TxtCustomerName.value = "";
form1.CmdLocateCustomer.disabled = true;
form1.CmbDept.disabled = false;
}
else
{
form1.CmdLocateCustomer.disabled = false;
form1.CmbDept.disabled = true;
}
}
</script>
</head>
<body bgcolor="#ccccff">
<form id="form1" runat="server">
<table style="width: 572px; height: 80px;">
<tr>
<td style="width: 94px">
</td>
<td><asp:CheckBox ID="ChkAllCustomer" runat="server" Text="All Customer" Width="117px" Checked="True" onclick="ChkAllCustomerClick()" /></td>
</tr>
<tr>
<td style="width: 94px">
Customer :</td>
<td>
<input id="TxtCustomerId" runat="server" readonly="readonly" style="width: 63px" type="text" /> <asp:Button
ID="CmdLocateCustomer" runat="server" Text="..." Width="25px" Enabled="False" />
<input id="TxtCustomerName" runat="server" readonly="readonly" style="width: 246px" type="text" /></td>
</tr>
<tr>
<td style="width: 94px">
Department :
</td>
<td>
<asp:DropDownList ID="CmbDept" runat="server" Width="95px"></asp:DropDownList></td>
</tr>
</table>
</form>
</body>
Partial Class RptLoan
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
LoadDepartment()
End If
End Sub
Sub LoadDepartment()
CmbDept.Items.Clear()
CmbDept.Items.Add("--ALL--")
CmbDept.Items.Add("BD1")
CmbDept.Items.Add("BD2")
CmbDept.Items.Add("BD3")
CmbDept.SelectedIndex = 0
End Sub
Protected Sub CmdLocateCustomer_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles CmdLocateCustomer.Click
End Sub
End Class