Groups | Blog | Home
all groups > asp.net datagrid control > august 2006 >

asp.net datagrid control : Databinding in tag problem!


bruce barker (sqlwork.com)
8/14/2006 11:19:47 AM
you have two problems. binding expressing must be the only specification of
an attribute value:

<asp:ImageButton ID="btnEdit" runat="server"
OnClientClick='<%# "OpenPopUp('Edit', 'true'," +
Container.DataItem("RegistrationID") + ")" %>'
ImageUrl="img/edit.gif"
/>

also the ImageButton will perform a browser postback, so you must cancel the
postback unless you want it.

-- bruce (sqlwork.com)


[quoted text, click to view]

vMike
8/14/2006 2:26:16 PM

[quoted text, click to view]
Try something like this.

OnClientClick=<%# "OpenPopUp('Edit', 'true'," +
Container.DataItem("RegistrationID") + ")" %>

Henk
8/14/2006 7:44:12 PM
Hello,
I have a problem, with a gridview, i won't a javascript function,
OpenPopUP(sCMD,bBoolean,iregID) to run when a image is clicked. So i add an
onclick event to the img tag like this. (this is in the itemtemplate off the
gridview)

<img src="img/edit.gif" style="width: 18px; height: 18px"
onclick="OpenPopUp('EDIT','true',<%#Container.DataItem("RegistrationID")%>)"
/>

this works fine, but why isnt the folowing code working:

<asp:ImageButton ID="btnEdit" runat="server"
OnClientClick="OpenPopUp('Edit',
'true',<%#Container.DataItem("RegistrationID")%>)" ImageUrl="img/edit.gif"
/>

I get some kind of error, server tag not well formed??
Can someone help me??

Thanks in regard..


Patrick Jox
8/14/2006 7:56:46 PM
I think this is a problem with the quotation marks. I would try something
like this.

OnClientClick='OpenPopUp("Edit",
"true",<%#Container.DataItem("RegistrationID")%>)'

Not sure but hope this helps
Patrick

"Henk" <Henkenboukje@versatel.nl> schrieb im Newsbeitrag
news:44e0b307$0$9404$bf4948fe@news.tele2.nl...
[quoted text, click to view]

AddThis Social Bookmark Button