Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net Datagrid Control (http://www.velocityreviews.com/forums/f60-asp-net-datagrid-control.html)
-   -   Databinding in tag problem! (http://www.velocityreviews.com/forums/t762933-databinding-in-tag-problem.html)

Henk 08-14-2006 05:44 PM

Databinding in tag problem!
 
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..




Patrick Jox 08-14-2006 05:56 PM

Re: Databinding in tag problem!
 
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...
> 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..
>
>
>




bruce barker \(sqlwork.com\) 08-14-2006 06:19 PM

Re: Databinding in tag problem!
 
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@versatel.nl> wrote in message
news:44e0b307$0$9404$bf4948fe@news.tele2.nl...
> 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..
>
>
>




vMike 08-14-2006 06:26 PM

Re: Databinding in tag problem!
 

"Henk" <Henkenboukje@versatel.nl> wrote in message
news:44e0b307$0$9404$bf4948fe@news.tele2.nl...
> 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") + ")" %>




All times are GMT. The time now is 05:44 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.