infragistics 获取 Rowedit 模板中下拉列表的 clientID

发布于 2024-10-24 02:51:39 字数 228 浏览 8 评论 0原文

我有一个基础设施网络网格,其中有行编辑模板。 行编辑模板包含下拉列表。现在,当我更改下拉列表的选定索引时.. 我需要获取下拉列表的客户端ID.. 网络网格位于内容占位符中..

我正在使用以下代码..ctl00_ContentPlaceHolder1_webModGrid_ctl00_ddlScope

它给出错误..Microsoft

JScript 运行时错误:需要对象

i have a infragistics web grid which has row edit template.
Row edit template contains drop down list. Now when i change the selected index of drop down..
i need to get the client id of the drop down..
the web grid is in Content place holder..

i am using the below code..

ctl00_ContentPlaceHolder1_webModGrid_ctl00_ddlScope

but it is giving error..

Microsoft JScript runtime error: Object required

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

三生殊途 2024-10-31 02:51:39

您可以尝试使用开关“ClientIDMode”及其值 Static

http://msdn.microsoft.com/en-us/library/system.web.ui.clientidmode.aspx

you can try to use the switch 'ClientIDMode' and its value Static

http://msdn.microsoft.com/en-us/library/system.web.ui.clientidmode.aspx

情深如许 2024-10-31 02:51:39

可以通过以下方式评估所需控件(及其客户端标记对象)的 ClientID 属性:

var clientID = '<%=ddlScope.ClientID%>';
var element = document.getElementById(clientID);
if (element) {
}

否则,如果将 DropDownList 放入 INamingContainer,则可以从通过处理控件的 Init 事件并按以下方式使用 ClientScript.RegisterStartupScript 方法来隐藏页面的代码:

<asp:DropDownList ID="ddlScope" runat="server" OnInit="ddlScope_Init">
</asp:DropDownList>

protected void ddlScope_Init(object sender, EventArgs e) {
    DropDownList ddl = (DropDownList)sender;
    string script = string.Format("var _{0} = document.getElementById('{1}');", ddl.ID, ddl.ClientID);
    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ANY_KEY", script, true);
}

var element = _ddlScope;
alert(element);

这有意义吗?

It is possible to evaluate the ClientID property of the required control (and its client-side tag object) in the following manner:

var clientID = '<%=ddlScope.ClientID%>';
var element = document.getElementById(clientID);
if (element) {
}

Otherwise, if the DropDownList is placed into the INamingContainer, it is possible to render the corresponding client-side object from the page’s code behind by handling the control’s Init event and using the ClientScript.RegisterStartupScript method in the following manner:

<asp:DropDownList ID="ddlScope" runat="server" OnInit="ddlScope_Init">
</asp:DropDownList>

protected void ddlScope_Init(object sender, EventArgs e) {
    DropDownList ddl = (DropDownList)sender;
    string script = string.Format("var _{0} = document.getElementById('{1}');", ddl.ID, ddl.ClientID);
    Page.ClientScript.RegisterStartupScript(Page.GetType(), "ANY_KEY", script, true);
}

var element = _ddlScope;
alert(element);

Does it make a sense?

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文