We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy. Image for the cookie policy date

SelectedIndex

I'm using this code to fill one dropdown list with another but nothing happens.aspx:                                                                                                                                                                    
                                                             
                                                                                           Broj narudžbe
                               
                                Status narudžbe
                               
                               


                                                                             
Razlog naručivanja
Mjesto troška
                               
                                   
                               
                                   



                                                                        VEZANI MATERIJAL
                                   

                                                                                                                                                    
                                                                                                                                                                                       vb.net code:   Protected Sub ddlRazlog_Selected_Index_Changed(ByVal sender As Object, ByVal e As Syncfusion.JavaScript.Web.DropdownListEventArgs)                      If (e.Value = 3) Then                      ddlMTNarudbe.DataSource = uma.dohvatiPodatke(conn, dohvatiOfficeNarudbeRazlog, "@PartnerID", Convert.ToInt32(Session("PartnerID").ToString()))                     ddlMTNarudbe.DataBind()                                   End If    End Sub

14 Replies

HV Hrvoje Voda May 23, 2017 10:56 AM UTC

Here is a file with code.
Attachment: dropDownList_d94e188b.7z


GG Gopi Govindasamy Syncfusion Team May 24, 2017 11:36 AM UTC

Hi Hrvoje, 

We have prepared a sample based on your requirement for dropdownlist value select to fill datasource to another dropdownlist. Please refer the below attached sample below link. 
  
  
Regards, 
Gopi G.   



HV Hrvoje Voda May 24, 2017 01:17 PM UTC

I can't open zip file.


GG Gopi Govindasamy Syncfusion Team May 25, 2017 11:10 AM UTC

Hi Hrvoje,  

We have open and checked the reported issue and the project is working fine. We have attached code snippet and sample below link.  

   <ej:DropDownList ID="ddlRazlogNarudbe" runat="server"  OnValueSelect="ddlRazlogNarudbe_ValueSelect" > 
                                      <Items> 
                                       <ej:DropDownListItem Text="Audi A4" Value="Audi A4"></ej:DropDownListItem> 
                                       <ej:DropDownListItem Text="Audi A5" Value="Audi A5"></ej:DropDownListItem> 
                                       <ej:DropDownListItem Text="Audi A6" Value="Audi A6"></ej:DropDownListItem> 
                                       <ej:DropDownListItem Text="Audi A7" Value="Audi A7"></ej:DropDownListItem> 
                                       <ej:DropDownListItem Text="Audi A8" Value="Audi A8"></ej:DropDownListItem> 
                                       </Items> 
                                    </ej:DropDownList></div> 
                                <div  style="float:left;width:300px"> 
                                    <ej:DropDownList ID="ddlMTNarudbe" runat="server"/></div><br /><br /><br /> 
 
 
Protected Sub ddlRazlogNarudbe_ValueSelect(sender As Object, e As Syncfusion.JavaScript.Web.DropdownListEventArgs) 
        If (e.ItemId = 3) Then 
            ddlMTNarudbe.DataTextField = "CustomerID" 
            ddlMTNarudbe.DataSource = "http://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/" 
            ddlMTNarudbe.Query = "ej.Query().from('Customers').take(6)" 
            ddlMTNarudbe.DataBind() 
        End If 
 



Regards, 
Gopi G. 



HV Hrvoje Voda May 29, 2017 01:35 PM UTC

I tried your code and it works.
Maybe the problem is that I'm using Master Page?



PO Prince Oliver Syncfusion Team May 30, 2017 10:16 AM UTC

Hi Hrvoje,   
  
Thank you for your update.   
  
Our controls will work fine in master page too. Please check whether you have included ScriptManager in your master page and also ensure that you have registered the Syncfusion.EJ.Web assembly in that page. Kindly refer to the following code snippet.   

[Site.Master] 
<%@ Register Assembly="Syncfusion.EJ.Web, Version=15.1450.0.41, Culture=neutral, PublicKeyToken=3d67ed1f87d44c89" Namespace="Syncfusion.JavaScript.Web" TagPrefix="ej" %> 
 
<asp:ScriptManager runat="server">         
    . . . . . . . . . . . 
</asp:ScriptManager> 

Regards, 
Prince 



HV Hrvoje Voda May 30, 2017 12:37 PM UTC

I have all that, but it still doesn't work.



KR Keerthana Rajendran Syncfusion Team May 31, 2017 06:56 AM UTC

Hi Hrvoje, 
 
We were unable to reproduce the issue and sample works fine at our end. Can you please provide us the sample to reproduce the issue  or else please share us the error details which you get on running our code. This will be helpful to analyze further and provide better solution at the earliest. 
 
 
Regards, 
Keerthana R. 



HV Hrvoje Voda May 31, 2017 07:12 AM UTC

I found the answer.I'm not using ej.web.all.min.js",                      ej.webform.min.js"Instead there is ej.widget.all.min.jsbecause those file are to large and it's reproduced on loading page.Is there a single .js file just for dropdownlist?And one more problem.Now I put does dropdownlists into popup dialog and when event is fired popup dialog closes.Why?


KR Keerthana Rajendran Syncfusion Team June 1, 2017 10:31 AM UTC

Hi Hrvoje,

Query: Is there a single .js file just for dropdownlist? 
  
   
We suggest you to generate custom scripts for DropDownList control using CSG. Please refer the below given link for details regarding CSG   
   
 
Query: And one more problem. Now I put does dropdownlists into popup dialog and when event is fired popup dialog closes. Why?    
   
We have checked this issue in previously updated sample with DropDownList inside ejDialog control. This issue occurs because OnValueSelect is a server side event and dialog is closed after postback because ShowOnInit is initially set to false.    
   
We suggest you to set true to ShowOnInit property of Dialog to true in code behind after databind to open the dialog in value select event as shown in the below code   
   
Protected Sub ddlRazlogNarudbe_ValueSelect(sender As Object, e As Syncfusion.JavaScript.Web.DropdownListEventArgs)   
        If (e.ItemId = 3) Then   
            ddlMTNarudbe.DataTextField = "CustomerID"   
            ddlMTNarudbe.DataSource = "http://js.syncfusion.com/demos/ejServices/Wcf/Northwind.svc/"   
            ddlMTNarudbe.Query = "ej.Query().from('Customers').take(6)"   
            ddlMTNarudbe.DataBind()   
        End If   
        dialogpopup.ShowOnInit = True   
   
   
We have modified the sample with these changes. Please refer to the below given link for sample   
   
   
   
Regards,   
Keerthana R.   
  
 



HV Hrvoje Voda June 9, 2017 11:38 AM UTC

Your code is working, but not good.
I don't want to refresh the entire page when I select something from dropdownlist.
I want that everything stay visible and just to make changes in other dropdownlist.



KR Keerthana Rajendran Syncfusion Team June 12, 2017 10:07 AM UTC

Hi Hrvoje, 
 
To avoid full post back we suggest you to use DropDownList inside update panel with AsyncPostBackTrigger. Please refer to the below given code 
 
<asp:UpdatePanel runat="server" UpdateMode="Conditional"> 
          <Triggers> 
              <asp:AsyncPostBackTrigger ControlID="ddlRazlogNarudbe" /> 
          </Triggers> 
          <ContentTemplate> 
 
              <ej:DropDownList ID="ddlRazlogNarudbe" runat="server" OnValueSelect="ddlRazlogNarudbe_ValueSelect"> 
                  <Items> 
                      <ej:DropDownListItem Text="Audi A4" Value="Audi A4"></ej:DropDownListItem> 
                      <ej:DropDownListItem Text="Audi A5" Value="Audi A5"></ej:DropDownListItem> 
                      <ej:DropDownListItem Text="Audi A6" Value="Audi A6"></ej:DropDownListItem> 
                      <ej:DropDownListItem Text="Audi A7" Value="Audi A7"></ej:DropDownListItem> 
                      <ej:DropDownListItem Text="Audi A8" Value="Audi A8"></ej:DropDownListItem> 
                  </Items> 
              </ej:DropDownList> 
              <br /> 
              <br /> 
              <div style="float: left; width: 300px"> 
                  <ej:DropDownList ID="ddlMTNarudbe" runat="server" /> 
              </div> 
              <bold><u> 
                                    VEZANI MATERIJAL</u></bold> 
              <br /> 
          </ContentTemplate> 
      </asp:UpdatePanel> 
             
 
 
We have prepared sample for reference. Please refer to the below given link 
 
 
Regards, 
Keerthana.


HV Hrvoje Voda June 13, 2017 12:30 PM UTC

You gave me an example on main page.
That is working fine, problem remains on popup dialog.
Nothing happens.



KR Keerthana Rajendran Syncfusion Team June 14, 2017 05:19 AM UTC

Hi Hrvoje,  
 
Sorry for the inconvenience caused 
 
We suggest you to use <asp:UpdatePanel> with ejDropDownList inside ejDialog so that you can bind data to second dropdown based on selection from first dropdown without refreshing the entire page. Please refer to the code below 
 
<ej:Dialog runat="server" ShowOnInit="false" ID="Dialog1"> 
          <DialogContent> 
              <asp:UpdatePanel runat="server" UpdateMode="Conditional"> 
                  <Triggers> 
                      <asp:AsyncPostBackTrigger ControlID="ddlRazlogNarudbe" /> 
                  </Triggers> 
                  <ContentTemplate> 
 
                      <ej:DropDownList ID="ddlRazlogNarudbe" runat="server" OnValueSelect="ddlRazlogNarudbe_ValueSelect"> 
                          <Items> 
                              <ej:DropDownListItem Text="Audi A4" Value="Audi A4"></ej:DropDownListItem> 
                              <ej:DropDownListItem Text="Audi A5" Value="Audi A5"></ej:DropDownListItem> 
                              <ej:DropDownListItem Text="Audi A6" Value="Audi A6"></ej:DropDownListItem> 
                              <ej:DropDownListItem Text="Audi A7" Value="Audi A7"></ej:DropDownListItem> 
                              <ej:DropDownListItem Text="Audi A8" Value="Audi A8"></ej:DropDownListItem> 
                          </Items> 
                      </ej:DropDownList> 
                      <br /> 
                      <br /> 
                      <div style="float: left; width: 300px"> 
                          <ej:DropDownList ID="ddlMTNarudbe" runat="server" /> 
                      </div> 
                      <bold><u> 
             VEZANI MATERIJAL</u></bold> 
                      <br /> 
                  </ContentTemplate> 
              </asp:UpdatePanel> 
          </DialogContent> 
      </ej:Dialog> 
 
We have modified a sample based on this. Please refer to the below given link 
 
 
 
Regards, 
Keerthana. 


Loader.
Live Chat Icon For mobile
Up arrow icon