TonyReba
asked on
DropDownList SelectedIndexChanged event fires twice on few Dropdowns
Could anyone explain me why txtPreppin_SelectedIndexCh anged event executes twice after txtPreppin value changed, then change value in second dropdownlist txtScanner
<asp:DropDownList
ID="txtPreppin" runat="server" CssClass="padding-input"
AutoPostBack="True" onselectedindexchanged="tx tPreppin_S electedInd exChanged" >
<asp:ListItem Text="-Select-" Value=''>-Select-</asp:Lis tItem>
<asp:ListItem>Acevedo, Noe</asp:ListItem>
.
.
.
.
.
</asp:DropDownList>
<br />
<label for="recordtype">
Date:</label><asp:TextBox ID="txtprepDate" runat="server"
Enabled="False" ReadOnly="True"></asp:Text Box>
<asp:CalendarExtender ID="txtprepDate_CalendarEx tender" runat="server"
Enabled="True" TargetControlID="txtprepDa te" Format="MM/dd/yyyy">
</asp:CalendarExtender>
</td>
<td style="width: 306px">
<label for="recordtype">
Scanner:</label><asp:DropD ownList
ID="txtScanner" runat="server" CssClass="padding-input"
AutoPostBack="True" onselectedindexchanged="tx tScanner_S electedInd exChanged" >
<asp:ListItem Text="-Select-" Value=''>-Select-</asp:Lis tItem>
<asp:ListItem>Bueno, Nancy</asp:ListItem>
.
.
.
.
.
</asp:DropDownList>
<label for="recordtype">
Date:</label>
<br />
<asp:TextBox ID="txtScanDate" runat="server"
Enabled="False" ReadOnly="True"></asp:Text Box>
<asp:CalendarExtender ID="txtScanDate_CalendarEx tender" runat="server"
Enabled="True" TargetControlID="txtScanDa te" Format="MM/dd/yyyy">
</asp:CalendarExtender>
protected void txtScanner_SelectedIndexCh anged(obje ct sender, EventArgs e)
{
if (Page.IsPostBack)
{
if (txtScanner.SelectedItem.T ext != null)
{
txtScanDate.Enabled = true;
txtScanDate.ReadOnly = false;
txtScanDate.Text = DateTime.Today.ToString("M M/dd/yyy") ;
}
else
{
txtScanDate.Enabled = false;
txtScanDate.ReadOnly = true;
}
}
}
protected void txtPreppin_SelectedIndexCh anged(obje ct sender, EventArgs e)
{
if (Page.IsPostBack)
{
if (txtPreppin.SelectedItem.T ext != null)
{
txtprepDate.Enabled = true;
txtprepDate.ReadOnly = false;
txtprepDate.Text = DateTime.Today.ToString("M M/dd/yyy") ;
}
else
{
txtprepDate.Enabled = false;
txtprepDate.ReadOnly = true;
}
}
}
<asp:DropDownList
ID="txtPreppin" runat="server" CssClass="padding-input"
AutoPostBack="True" onselectedindexchanged="tx
<asp:ListItem Text="-Select-" Value=''>-Select-</asp:Lis
<asp:ListItem>Acevedo, Noe</asp:ListItem>
.
.
.
.
.
</asp:DropDownList>
<br />
<label for="recordtype">
Date:</label><asp:TextBox ID="txtprepDate" runat="server"
Enabled="False" ReadOnly="True"></asp:Text
<asp:CalendarExtender ID="txtprepDate_CalendarEx
Enabled="True" TargetControlID="txtprepDa
</asp:CalendarExtender>
</td>
<td style="width: 306px">
<label for="recordtype">
Scanner:</label><asp:DropD
ID="txtScanner" runat="server" CssClass="padding-input"
AutoPostBack="True" onselectedindexchanged="tx
<asp:ListItem Text="-Select-" Value=''>-Select-</asp:Lis
<asp:ListItem>Bueno, Nancy</asp:ListItem>
.
.
.
.
.
</asp:DropDownList>
<label for="recordtype">
Date:</label>
<br />
<asp:TextBox ID="txtScanDate" runat="server"
Enabled="False" ReadOnly="True"></asp:Text
<asp:CalendarExtender ID="txtScanDate_CalendarEx
Enabled="True" TargetControlID="txtScanDa
</asp:CalendarExtender>
protected void txtScanner_SelectedIndexCh
{
if (Page.IsPostBack)
{
if (txtScanner.SelectedItem.T
{
txtScanDate.Enabled = true;
txtScanDate.ReadOnly = false;
txtScanDate.Text = DateTime.Today.ToString("M
}
else
{
txtScanDate.Enabled = false;
txtScanDate.ReadOnly = true;
}
}
}
protected void txtPreppin_SelectedIndexCh
{
if (Page.IsPostBack)
{
if (txtPreppin.SelectedItem.T
{
txtprepDate.Enabled = true;
txtprepDate.ReadOnly = false;
txtprepDate.Text = DateTime.Today.ToString("M
}
else
{
txtprepDate.Enabled = false;
txtprepDate.ReadOnly = true;
}
}
}
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
View state is enabled.
Thasts not the problem.
Thasts not the problem.
ASKER
View State was enabled on the page, but not on the masterpage.....
ASKER
Viewstate wasnt enabled on Master Page
ASKER
Thasts not the problem.