0

I am trying to pass a row index to my javascript function using the below line that resides inside the gridview, but I keep getting an error.

Below is my code.

<asp:TemplateField HeaderText="MCLID"> 
    <ItemTemplate> 
        <label style="text-decoration: underline"
         onclick="javascript:warningMessage('<%# Eval("ID") %>','<%# Eval("systempath").ToString().Replace("'",@"\'") %>','<%# Eval("root_level") %>','<%# Eval("Parentid") %>','<%# Eval(Container.DataItemIndex +1) %>');"><%#Eval("ID") %></label> 
    </ItemTemplate> 
</asp:TemplateField>

any help will be appreciated.

RobG
  • 142,382
  • 31
  • 172
  • 209
Avinash Chandra
  • 183
  • 1
  • 7
  • 24
  • 1
    Post the relevant part of what you get in the browser (i.e. what does the above actually generate). What error do you get? Where do you get it, on the server or at the client? – RobG Nov 28 '12 at 23:26
  • what is the error? Post your js function too. – ankur Nov 29 '12 at 05:38

1 Answers1

3

Instead of:

onclick="javascript:warningMessage('<%# Eval("ID") %>','<%# Eval("systempath").ToString().Replace("'",@"\'") %>','<%# Eval("root_level") %>','<%# Eval("Parentid") %>','<%# Eval(Container.DataItemIndex +1) %>');"

Try using something like:

onclick='<%# "javascript:warningMessage('" + Eval("ID").ToString() + "'" %>'
jr pineda
  • 186
  • 7