Quantcast
Channel: Web Forms
Viewing all articles
Browse latest Browse all 23244

JQuery Code not working properly after dropdownlist select change event is used

$
0
0

Hi ,

 i have dropdownlist inside an update panel and using selected index changed of the ddl(autopostback="true").   after select any value jquery not working...

code.

 <asp:ScriptManager ID="ScriptManager1" runat="server" >
    </asp:ScriptManager>
 <asp:UpdatePanel ID="panel" runat="server">
 <ContentTemplate>
 
            
            <div>

        UserId :<asp:DropDownList ID="drplist1" runat="server" Width="20%" AutoPostBack="True"
                       onselectedindexchanged="drplist1_SelectedIndexChanged">
                        <asp:ListItem Value="1" >0</asp:ListItem>
                          <asp:ListItem Value="2" >1</asp:ListItem>
                            <asp:ListItem Value="3" >2</asp:ListItem>
        </asp:DropDownList>
        <asp:DropDownList ID="drplist2" runat="server"  Width="20%" AutoPostBack="True"
                        onselectedindexchanged="drplist2_SelectedIndexChanged">
                        <asp:ListItem Value="100" >0</asp:ListItem>
                          <asp:ListItem Value="200" >1</asp:ListItem>
        </asp:DropDownList></div>
                      
                    <div class="block-fluid" >
                       <asp:GridView ID="gridView" CssClass="fTable" runat="server" AutoGenerateColumns="false"  >
                       <Columns>
                       <asp:TemplateField>
                       <HeaderTemplate>                
                      <input type="checkbox" class="checkall"/>
                      <th width="25%"> Designation</th>
                      <th width="20%"> Name</th>
                      <th width="20%"> Salary</th>
                      <th width="20%">Date</th>
                        <th width="20%">Actions</th>
                         
                      
                  
                       </HeaderTemplate>
                      
                       
                       <ItemTemplate>
                      
               <input type="checkbox" name="order[]" />
                   <td> <%#Eval("Designation")%></td>
                       <td> <%#Eval("name")%></td>
                       <td> <%#Eval("sal")%></td>
                       <td> <%#Eval("date")%></td>
                       
                         <td class="TAC">
                         
                                      <%-- <a href="#"><span class="icon-ok"></span></a>
                                       <a href="#" id="jDialog_form_button"><span class="icon-pencil"></span></a>
                                        <a href="#"><span class="icon-trash"></span></a>--%>
                                         <%--<button class="btn" id="jDialog_form_button">Form dialog</button> --%>
                                         
                                    </td>
                          
                       
                       
                       </ItemTemplate>
                       </asp:TemplateField>
                       </Columns>
                       </asp:GridView>
                 
               
                       
                    </div>
                    </ContentTemplate></asp:UpdatePanel>

.cs

protected void drplist2_SelectedIndexChanged(object sender, EventArgs e)
    {
        //BindGrid2();
    }
    protected void drplist1_SelectedIndexChanged(object sender, EventArgs e)
    {
        BindGrid2();
    }
    void BindGrid2()
    {

        conn.Open();
        int i = Convert.ToInt16(drplist1.SelectedValue.ToString());
        SqlDataAdapter da = new SqlDataAdapter("select *from emp where id=" + i, conn);
        DataSet ds = new DataSet();
        da.Fill(ds);
        gridView.DataSource = ds.Tables[0];
        gridView.DataBind();
       
        if (gridView.Rows.Count > 0)
        {
            gridView.UseAccessibleHeader = true;
            gridView.HeaderRow.TableSection = TableRowSection.TableHeader;
            gridView.FooterRow.TableSection = TableRowSection.TableFooter;
        }
        conn.Close();
        
    }


Viewing all articles
Browse latest Browse all 23244

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>