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

N

Nish

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
 
R

Rick Spiewak

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);
}
 
N

Nish

thank you very much.
Your code helped me.
Nish

Rick Spiewak said:
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);
}
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,539
Members
45,024
Latest member
ARDU_PROgrammER

Latest Threads

Top