javascript, datalist control and validation

R

rufus

I have added some javascript to a button which is built in the
MyDataList_ItemCreated event. It produces the following code which works (ie
the EnableValidators function fires):

<input type="submit" name="btn2" value="Button" onclick="if
(typeof(Page_ClientValidate) == 'function') Page_ClientValidate(); "
language="javascript" id="btn2" OnMousedown="EnableValidators('Group2_');" />

So I tried the same thing for a button contained in a datalist and it
produces the following code:

<input type="submit" name="MyDataList:_ctl1:edit_Button" value="Edit"
onclick="if (typeof(Page_ClientValidate) == 'function')
Page_ClientValidate(); " language="javascript"
id="MyDataList__ctl1_edit_Button"
OnMousedown="EnableValidators('editGroup_');" />

This doesn't work (ie the function EnableValidators does not fire. I am
pretty sure the reason is that in the first example the id and name attribute
are the same but in my datalist example they are different. Becuase I dont
seem to have any control over how the id and name are generated in a datalist
I am lost.

Does anyone have an answer of even an alternative method for achieving this.

Thanks
 

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,780
Messages
2,569,611
Members
45,278
Latest member
BuzzDefenderpro

Latest Threads

Top