Adding attribute to JavaScript validator object in the Page_Validators array

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Jim Ox

    Adding attribute to JavaScript validator object in the Page_Validators array

    I have created a custom validator control that implements the
    BaseValidator. However I would like to add an attribute to the
    JavaScript validation object that is rendered at the bottom of the
    page. Currently something like the following is at the bottom of the
    page:

    var ctl00_MasterPag es_MemberSelect ed = document.all ?
    document.all["ctl00_MasterPa ges_MemberSelec ted"] :
    document.getEle mentById("ctl00 _MasterPages_Me mberSelected");
    ctl00_MasterPag es_MemberSelect ed.errormessage = "This is an error
    message";
    ctl00_MasterPag es_MemberSelect ed.display = "Dynamic";
    ctl00_MasterPag es_MemberSelect ed.validationGr oup = "ValidationGrou p";

    I would like to add attributes to this object, for example:

    ctl00_MasterPag es_MemberSelect ed.newAttribute One = "Attribute1 ";
    ctl00_MasterPag es_MemberSelect ed.newAttribute Two = "Attribute2 ";

    Does anyone know how this can be done?

  • JimOx

    #2
    RE: Adding attribute to JavaScript validator object in the Page_Valida

    I found the solution to this which is to use
    Page.ClientScri pt.RegisterExpa ndoAttribute.

    "Jim Ox" wrote:
    [color=blue]
    > I have created a custom validator control that implements the
    > BaseValidator. However I would like to add an attribute to the
    > JavaScript validation object that is rendered at the bottom of the
    > page. Currently something like the following is at the bottom of the
    > page:
    >
    > var ctl00_MasterPag es_MemberSelect ed = document.all ?
    > document.all["ctl00_MasterPa ges_MemberSelec ted"] :
    > document.getEle mentById("ctl00 _MasterPages_Me mberSelected");
    > ctl00_MasterPag es_MemberSelect ed.errormessage = "This is an error
    > message";
    > ctl00_MasterPag es_MemberSelect ed.display = "Dynamic";
    > ctl00_MasterPag es_MemberSelect ed.validationGr oup = "ValidationGrou p";
    >
    > I would like to add attributes to this object, for example:
    >
    > ctl00_MasterPag es_MemberSelect ed.newAttribute One = "Attribute1 ";
    > ctl00_MasterPag es_MemberSelect ed.newAttribute Two = "Attribute2 ";
    >
    > Does anyone know how this can be done?
    >
    >[/color]

    Comment

    Working...