HighTechTalks DotNet Forums  

Databinding in tag problem!

ASP.net Data Grid Control microsoft.public.dotnet.framework.aspnet.datagridcontrol


Discuss Databinding in tag problem! in the ASP.net Data Grid Control forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Henk
 
Posts: n/a

Default Databinding in tag problem! - 08-14-2006 , 01:44 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.Data Item("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..




Reply With Quote
  #2  
Old   
Patrick Jox
 
Posts: n/a

Default Re: Databinding in tag problem! - 08-14-2006 , 01:56 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 (AT) versatel (DOT) nl> schrieb im Newsbeitrag
news:44e0b307$0$9404$bf4948fe (AT) news (DOT) tele2.nl...
Quote:
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.Data Item("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..






Reply With Quote
  #3  
Old   
bruce barker \(sqlwork.com\)
 
Posts: n/a

Default Re: Databinding in tag problem! - 08-14-2006 , 02:19 PM



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)


"Henk" <Henkenboukje (AT) versatel (DOT) nl> wrote

Quote:
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.Data Item("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..






Reply With Quote
  #4  
Old   
vMike
 
Posts: n/a

Default Re: Databinding in tag problem! - 08-14-2006 , 02:26 PM




"Henk" <Henkenboukje (AT) versatel (DOT) nl> wrote

Quote:
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.Data Item("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..


Try something like this.

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




Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.