JS如何获取自定义组件的ID

    技术2022-05-11  26

    组件(ascx):

      <%@ Control Language="C#" AutoEventWireup="true" CodeFile="DropDownListFiller.ascx.cs" Inherits="DropDownListFiller" %><asp:DropDownList ID="dropdownList" runat="server"></asp:DropDownList>

    引用组件页:

        注册组件:

    <%@ Register TagPrefix="doublefox" TagName="DropDownListFileFormat" Src="~/Control/DropDownListFiller.ascx" %>

       显示引用的组件:

    <DOUBLEFOX:DropDownListFileFormat ID="ddlFileFormat" runat="server" />

    那如何得当前引用组件的ID(DropDownListFileFormat )的呢

    wrong:

      var ddlID= document.getElementById("ddlFileFormat");

    right:

      var ddl= document.getElementById("ddlFileFormat_dropdownList");为什么,就因这是.net2.0哈哈 


    最新回复(0)