Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
45
Pass Value of WebDropDown to hidden field Client Side
posted

Hi,

  I have a asp.net(form .net 4.0) application  that is a simple report program. I want to pass the value of a webdropdown to a hidden field. Please Help!

.netadvantage 10.3

function

btnsubmit_click(sender, evntArgs) {

var ddlYear = document.getElementById('<%=ddlYear.ClientID%>');

document.getElementById(

 

'hfYear').value = ddlYear.options[ddlYear.selectedIndex].text;

 

//document.getElementById('hfYear').value = document.getElementById('ddlYear').value;

}

<ig:WebDropDown ID="ddlYear" runat="server" TextField="Year" Width="55"  AutoPostBack="false"></ig:WebDropDown>

 

 

 

 

<asp:HiddenField id="hfYear" runat="server" Value=""/>

<asp:Button ID="Submit" runat="server" Text="Submit" OnClick="Submit_Click" ValidationGroup="FANumber" Width="80px" CssClass="button" OnClientClick="btnsubmit_click"/>

int

 

 

 

selectedYear = Convert.ToInt32(this.hfYear.Value);

Parents
No Data
Reply
  • 5105
    Offline posted

    Hi there,

    Do you mean you want to get the selected value of the drop down?

    Looking forward to your reply.

Children
No Data