Click here to Skip to main content
15,894,291 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
My problem is simple, i have a datalist control with some controls inside of
EditTemplate (the problem is the same in the DataGrid). I want to have
access to this controls, using javascript, but
i can't. How can i do this?

XML
<Code>
<script language="javascript">
document.getElementById('<%=txt1.ClientID %>').value='test';
document.getElementById('<%=txt2.ClientID %>').value='test';
</script>
....

<asp:DataList id="Test" ...><EditItemTemplate>
<asp:textbox id="txt1" runat=server></asp:textbox></EditItemTemplate>
</asp:DataList>...

<asp:textbox id="txt2" runat=server></asp:textbox>
</Code>
Posted

1 solution

In datagrid their are no of rows added. You can access using JavaScript
$(document).ready(function(){
// Gridname row attribute event
$("#EvoEditGrid0 tr").live("change",function() {
if (!this.rowIndex) return;
//to access columns in a row
for(var i=0; i<this.cells.length;i++)>
{
//txt1 id
var item=$(this).find('#evolGFE1').attr("value");
if(item == ""){
alert("Select Item");
return;
}
}
});
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900