1
Answer

Listbox onselectindex event is not firing?

Harish Batchu

Harish Batchu

6y
494
1
<ul role="tablist" class="nav nav-tabs ver-nav-tab" id="myTabs_8">
<li class="active" role="presentation"><a aria-expanded="true" data-toggle="tab" role="tab" id="home_tab_8" href="#home_8">ALL</a></li>
<li role="presentation" class=""><a data-toggle="tab" id="profile_tab_8" role="tab" href="#profile_8" aria-expanded="false">Reports</a></li>
<li class="dropdown" role="presentation">
<a data-toggle="dropdown" class="dropdown-toggle" id="myTabDrop_8" href="#" aria-expanded="false">Month Wise <span class="caret"></span></a>
<asp:ListBox ID="ListMenu" runat="server" class="dropdown-menu" OnSelectedIndexChanged="GetByMonth" >
<asp:ListItem Value="04">APR</asp:ListItem>
<asp:ListItem Value="05">MAY</asp:ListItem>
<asp:ListItem Value="06">JUN</asp:ListItem>
<asp:ListItem Value="07">JUL</asp:ListItem>
<asp:ListItem Value="08">AUG</asp:ListItem>
<asp:ListItem Value="09">SEP</asp:ListItem>
<asp:ListItem Value="10">OCT</asp:ListItem>
<asp:ListItem Value="11">NOV</asp:ListItem>
<asp:ListItem Value="12">DEC</asp:ListItem>
<asp:ListItem Value="01">JAN</asp:ListItem>
<asp:ListItem Value="02">FEB</asp:ListItem>
<asp:ListItem Value="03">MAR</asp:ListItem>
</asp:ListBox>
</li>
</ul>
protected void GetByMonth(object sender, EventArgs e)
{
con = getcon.GetConnection();
int s = ListMenu.SelectedIndex;
cmd = new SqlCommand("select IncomeType,UserIncomeDetail_Amount from ft_UserIncomeDetail inner join Dim_IncomeType on ft_UserIncomeDetail.IncomeType_Id=Dim_IncomeType.IncomeType_id where MONTH(UserIncomeDetail_Date) = '" + s + "' and ft_UserIncomeDetail.User_Uniq='150883940'",con);
cmd.CommandType = CommandType.Text;
SqlDataAdapter sda = new SqlDataAdapter(cmd);
DataSet ds = new DataSet();
sda.Fill(ds);
Gridview_Bymonth.DataSource = ds;
Gridview_Bymonth.DataBind();
con.Close();
}
Answers (1)
1
Amit Gupta

Amit Gupta

NA 22.9k 247.2k 5y
Random class doesn't guarantee to generate unique values its just to get random values. If you need all unique values then you must apply a validation im it.
0
Ankit  Shukla

Ankit Shukla

NA 681 121.7k 5y
I have already tried but no success.
0
Amit Gupta

Amit Gupta

NA 22.9k 247.2k 5y
Can you try clear and rebuild your project and clear cache of browser
0
Ankit  Shukla

Ankit Shukla

NA 681 121.7k 5y
It works fine when I debug code. But without debugging, all rows have same values.
0
Ankit  Shukla

Ankit Shukla

NA 681 121.7k 5y
But, if I am trying 20 times. Then at least 1 time it should work. And I am using difficult mechanism of random no. Which never gives same result in 20 tests.