How to implemet the same code in temple column(text box)

Discussion in 'ASP .Net Datagrid Control' started by Nish, Jul 2, 2004.

  1. Nish

    Nish Guest

    I have the following code in my text box blur event.
    function MakeYearComplete(frmName,ctlName,EntTxt)
    {
    _eval('var txtObj = document.' + frmName + '.' + ctlName + ';');
    var s = EntTxt.lastIndexOf("/");

    var YearPart = EntTxt.substring((s + 1));

    var ObjDate =new Date(EntTxt);

    var ObjMMPart = ObjDate.getMonth() + 1;

    var ObjDDPart = ObjDate.getDate();

    if (YearPart.toString().length == 2)

    txtObj.value = ObjMMPart + "/" + ObjDDPart + "/" + "20" +
    YearPart.toString()

    }

    How to achieve the same effect on data grid templete column which has text
    box? Only the problem here I am facing is I could not set the processed data
    back to the text box control inside the grid.

    Thanks for your advice.

    -Nish
     
    Nish, Jul 2, 2004
    #1
    1. Advertising

  2. Nish

    Rick Spiewak Guest

    The textbox control will have a different name at runtime, which you can
    compute. Here is a snippet I use to find the correct ID of a validator that
    might help:

    function reEnableValidation(ctrl, ckName, validator)
    {
    //The ID at runtime has a prefix that looks like: dgLineItems__ctl2_
    var ID = ctrl.id;
    var i = ID.indexOf("__");
    i = ID.indexOf("_", i + 2);
    // Extract the prefix, and prepend it to the "original" CheckBox name as
    provided
    var chkBoxID = ID.substring(0,i) + "_" + ckName;
    var chkBox = document.getElementById(chkBoxID);
    enableValidation(chkBox, validator);
    }

    "Nish" <> wrote in message
    news:%234MPDc%...
    > I have the following code in my text box blur event.
    > function MakeYearComplete(frmName,ctlName,EntTxt)
    > {
    > _eval('var txtObj = document.' + frmName + '.' + ctlName + ';');
    > var s = EntTxt.lastIndexOf("/");
    >
    > var YearPart = EntTxt.substring((s + 1));
    >
    > var ObjDate =new Date(EntTxt);
    >
    > var ObjMMPart = ObjDate.getMonth() + 1;
    >
    > var ObjDDPart = ObjDate.getDate();
    >
    > if (YearPart.toString().length == 2)
    >
    > txtObj.value = ObjMMPart + "/" + ObjDDPart + "/" + "20" +
    > YearPart.toString()
    >
    > }
    >
    > How to achieve the same effect on data grid templete column which has text
    > box? Only the problem here I am facing is I could not set the processed

    data
    > back to the text box control inside the grid.
    >
    > Thanks for your advice.
    >
    > -Nish
    >
    >
    >
    >
    >
    >
     
    Rick Spiewak, Jul 2, 2004
    #2
    1. Advertising

  3. Nish

    Nish Guest

    thank you very much.
    Your code helped me.
    Nish

    "Rick Spiewak" <> wrote in message
    news:...
    > The textbox control will have a different name at runtime, which you can
    > compute. Here is a snippet I use to find the correct ID of a validator

    that
    > might help:
    >
    > function reEnableValidation(ctrl, ckName, validator)
    > {
    > //The ID at runtime has a prefix that looks like: dgLineItems__ctl2_
    > var ID = ctrl.id;
    > var i = ID.indexOf("__");
    > i = ID.indexOf("_", i + 2);
    > // Extract the prefix, and prepend it to the "original" CheckBox name

    as
    > provided
    > var chkBoxID = ID.substring(0,i) + "_" + ckName;
    > var chkBox = document.getElementById(chkBoxID);
    > enableValidation(chkBox, validator);
    > }
    >
    > "Nish" <> wrote in message
    > news:%234MPDc%...
    > > I have the following code in my text box blur event.
    > > function MakeYearComplete(frmName,ctlName,EntTxt)
    > > {
    > > _eval('var txtObj = document.' + frmName + '.' + ctlName + ';');
    > > var s = EntTxt.lastIndexOf("/");
    > >
    > > var YearPart = EntTxt.substring((s + 1));
    > >
    > > var ObjDate =new Date(EntTxt);
    > >
    > > var ObjMMPart = ObjDate.getMonth() + 1;
    > >
    > > var ObjDDPart = ObjDate.getDate();
    > >
    > > if (YearPart.toString().length == 2)
    > >
    > > txtObj.value = ObjMMPart + "/" + ObjDDPart + "/" + "20" +
    > > YearPart.toString()
    > >
    > > }
    > >
    > > How to achieve the same effect on data grid templete column which has

    text
    > > box? Only the problem here I am facing is I could not set the processed

    > data
    > > back to the text box control inside the grid.
    > >
    > > Thanks for your advice.
    > >
    > > -Nish
    > >
    > >
    > >
    > >
    > >
    > >

    >
    >
     
    Nish, Jul 4, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Gnarlodious
    Replies:
    4
    Views:
    17,708
    elizas
    May 5, 2010
  2. O'Neal Computer Programmer

    python scripting game The Temple Of Elemental Evil update

    O'Neal Computer Programmer, Jul 7, 2003, in forum: Python
    Replies:
    1
    Views:
    431
    Bengt Richter
    Jul 7, 2003
  3. O'Neal Computer Programmer

    Temple of Elemental Evil and Python

    O'Neal Computer Programmer, Oct 30, 2003, in forum: Python
    Replies:
    0
    Views:
    616
    O'Neal Computer Programmer
    Oct 30, 2003
  4. Baron Samedi
    Replies:
    7
    Views:
    413
    Anand Hariharan
    Mar 30, 2009
  5. Trevor Turk

    Ruby, Debian, and Media Temple

    Trevor Turk, Dec 18, 2006, in forum: Ruby
    Replies:
    5
    Views:
    143
    Eric Hodel
    Dec 19, 2006
Loading...

Share This Page