English 中文(简体)
选用在Asp.net的无线电台中的人口
原标题:Selecting radiobuttons populated within asp.net RadioButtonList with jQuery

Hello and thanks in advance for the communal help I always find here. I have been tinkering around with what should seem a pretty straight forward task even for a jQuery newb as myself. I have a radiobuttonlist control bound to a collection:

<asp:RadioButtonList ID="radBtnLstPackageSelector" runat="server" 
 CssClass="PackageS">
</asp:RadioButtonList>

My form does have several other controls of the same type; Now, the challenge is to select and wire up a on Click event for every radiobutton from the radBtnLstPackageSelector.
I have tried several approaches such as:

var results1 = $(".PackageS").children("input");
var results1 = $(".PackageS").children("input[type=radiobutton");
var results1 = $("table.PackageS > input[type=radiobutton");

with no luck... Your help would be great right now! ~m

最佳回答

你们也可以利用协会成员的身份识别仪来定点。 该网络将产生(尽管这是最佳解决办法,并可能改变未来版本的ASP)。 NET:

$(function() {
    $("[id*=radBtnLstPackageSelector]:radio").click(function() {
        alert( $(this).val() );  // Alerts the value of the radio button.
    });
});

All IDs inside radBtnLstPackageSelector will be in the form of
[other naming containers if there are any]_radBtnLstPackageSelector_[index of the element 1..last]

问题回答

因此,请在<代码>的每个无线电台上点击。 全套S。 这项权利吗?

如果是,

$(function() {
    $(".PackageS :radio").click(function() {
        alert( $(this).val() );  // Alerts the value of the radio button.
    });
});




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签