|
Forums » .NET » ASP.NET »
|
OnClientClick event of Image button in repeater control |
Posted Date: 20 Sep 2008 Posted By:: Yasotha Member Level: Silver Member Rank: 1413 Points: 1
Responses:
3
|
hi
i am using image button with in repeater control. i have to pass binding value to one javascript function from image button onclientclick event. my code as follows
<asp:ImageButton ID="ImgbtnSetPermission" runat="server" ImageUrl="~/Images/Edit.jpg" OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,"COL_ID")%>)" OnClick="ImgbtnSetPermission_Click()" CausesValidation="false" />
I am getting an error like
"The server tag is not well formed." for this OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,"COL_ID")%>)"
thanks in advance
|
Responses
|
#297897 Author: D.Jeya kumar(JK) Member Level: Gold Member Rank: 12 Date: 20/Sep/2008 Rating:  Points: 5 | Hi,
Are you using the image control in server side. ie in code behind with below function
ImgbtnSetPermission_Click if you have a function like this in code behind then remove the () in click event
OnClick="ImgbtnSetPermission_Click()"
OnClick="ImgbtnSetPermission_Click"
<asp:ImageButton ID="ImgbtnSetPermission" runat="server" ImageUrl="~/Images/Edit.jpg" OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,"COL_ID")%>)" OnClick="ImgbtnSetPermission_Click()" CausesValidation="false" />
Regards JK
Thanks & Regards D.Jeya Kumar(JK)
| #297898 Author: Yasotha Member Level: Silver Member Rank: 1413 Date: 20/Sep/2008 Rating:  Points: 4 | Hi
Thanks for ur reply. I have removed and tested but again it shows the same error. because of pssing binding value to javascript only am getting this error. if i give static value like this then it is working well. OnClientClick="javascript:return fnSetPermission('84')
| #306233 Author: vinod Member Level: Bronze Member Rank: 0 Date: 13/Oct/2008 Rating:  Points: 6 | Hi,
<asp:ImageButton ID="ImgbtnSetPermission" runat="server" ImageUrl="~/Images/Edit.jpg" OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,"COL_ID")%>)" OnClick="ImgbtnSetPermission_Click()" CausesValidation="false" />
You must remove double quotes around COL_ID, you may place single quotes... <asp:ImageButton ID="ImgbtnSetPermission" runat="server" ImageUrl="~/Images/Edit.jpg" OnClientClick="javascript:return fnSetPermission(<%# DataBinder.Eval(Container.DataItem,'COL_ID')%>)" OnClick="ImgbtnSetPermission_Click()" CausesValidation="false" />
Check if this helps
Regards,
VINOD
|
|
| Post Reply |
|
|
|
 | | This thread is locked for new responses. Please post your comments and questions as a separate thread. If required, refer to the URL of this page in your new post. |
|
|
|
|
 Follow us on Twitter: https://twitter.com/dotnetspider
|
|