javascript-如何在jQuery中访问asp .net dropdownlist和lable的值? [英] How to access value of asp .net dropdownlist and lable in jquery?

查看:50
本文介绍了javascript-如何在jQuery中访问asp .net dropdownlist和lable的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

下面的代码不起作用:

var valBusType = $(''#%= Label2_fromTo.ClientID%>'').html();

谢谢大家的答复.在这里,我正在改善我的问题,以便可以更容易理解和回答.

我的default.aspx页(在.net 3.5中)具有这些控件.
1:

Below code is not working:

var valBusType =$(''#%=Label2_fromTo.ClientID %>'').html();

Thank you all, for your reply. Here I am improving my question so that it can be more understandable and answerable.

I have these controls on my default.aspx page (in .net 3.5)
1:

<asp:DropDownList ID="DdlPickUpPoint" runat="server" CssClass="select" Width="300"></asp:DropDownList>



2:



2:

<asp:TextBox ID="txtSeatNo" runat="server" CssClass="hideBorder" onKeyPress="return false"></asp:TextBox>



3:



3:

<asp:Label ID="lblTotAmt" runat="server"  ></asp:Label>



现在,我想使用jquery在JScript.js中获取这些控件的值,然后将其传递给webservice.代码在下面




Now I want to get values of these controls in JScript.js using jquery and then pass it to webservice . Code is below


var valTotValue= =$('#<%=lblTotAmt.ClientID %>').val();
var valSeatNo= =$('#<%=txtSeatNo.ClientID %>').val();
var valPickupPoint =$('#<%=DdlPickUpPoint.ClientID %>').html();
debugger;
$.ajax(
{
 type: "POST",
 url: "WebService_SeatLayout.asmx/GetLayout
 data:"{'strTotValue' : " + valTotValue + ",'strSeatNo': "+ valSeatNo + ",'valSeatNo' : " + valPickupPoint + "}",

contentType: "application/json; charset=utf-8",
dataType: "json",
async: true,
cache: false,
success: function (msg)
{

alert(msg.d);
if(msg.d==true)
{
 var url = 'CustInfo.aspx';
 window.location.href = url;
 }

           },
           error: function (x, e)
           {
           alert("The call to the server side failed. " + x.responseText);
           }
       }
   );
   return false;

推荐答案

(``#%= Label2_fromTo.ClientID%>'')).html();

谢谢大家的答复.在这里,我正在改善我的问题,以便可以更容易理解和回答.

我的default.aspx页(在.net 3.5中)具有这些控件.
1:
(''#%=Label2_fromTo.ClientID %>'').html();

Thank you all, for your reply. Here I am improving my question so that it can be more understandable and answerable.

I have these controls on my default.aspx page (in .net 3.5)
1:
<asp:DropDownList ID="DdlPickUpPoint" runat="server" CssClass="select" Width="300"></asp:DropDownList>



2:



2:

<asp:TextBox ID="txtSeatNo" runat="server" CssClass="hideBorder" onKeyPress="return false"></asp:TextBox>



3:



3:

<asp:Label ID="lblTotAmt" runat="server"  ></asp:Label>



现在,我想使用jquery在JScript.js中获取这些控件的值,然后将其传递给webservice.代码在下面




Now I want to get values of these controls in JScript.js using jquery and then pass it to webservice . Code is below


var valTotValue= =


(' #<%= lblTotAmt.ClientID%>').val(); var valSeatNo = =
('#<%=lblTotAmt.ClientID %>').val(); var valSeatNo= =


(' var valPickupPoint =
('#<%=txtSeatNo.ClientID %>').val(); var valPickupPoint =


这篇关于javascript-如何在jQuery中访问asp .net dropdownlist和lable的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆