473,414 Members | 1,700 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

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..

Aug 14 '06 #1
3 1395
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" <He**********@versatel.nlschrieb im Newsbeitrag
news:44**********************@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..

Aug 14 '06 #2
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" <He**********@versatel.nlwrote in message
news:44**********************@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..

Aug 14 '06 #3

"Henk" <He**********@versatel.nlwrote in message
news:44**********************@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") + ")" %>
Aug 14 '06 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: dtblankenship | last post by:
Hello everyone, I know this question has been asked many times in the forums, and after spending a few days reading, I am still confused as to the answer. I have a ListBox (lstBox),...
3
by: Kevin Swanson | last post by:
I'm writing what should be a very simple app against an Oracle database. The app has a number of user controls, any one of which is loaded into a main display page using the loadControl method,...
4
by: Nathan Sokalski | last post by:
I have two databinding expressions (the first & last names from a DB) that I want to assign to the text property of a Label so that the result is LASTNAME,FIRSTNAME. At the moment, I have the...
8
by: GaryDean | last post by:
We have been noticing that questions on vs.2005/2.0 don't appear to get much in answers so I'm reposting some questions posted by some of the programmers here in our organization that never got...
9
by: J055 | last post by:
Hi I have a very simple configuration of the GridView with paging and sorting. When I do a postback the DataBinding event fires twice - in both the ProcessPostData and PreRender stages of the...
9
by: Nathan Sokalski | last post by:
I have a very simple UserControl which contains an Image and a Label, which I use to display an image with a caption. I am using this control inside a DataList, setting the two Public variables...
1
by: Owen Blacker | last post by:
I've spent loads of time Googling to try to work this one out and I'm sure it's something obvious. I get an InvalidOperationException reading "Databinding methods such as Eval(), XPath(), and...
8
by: Dirk | last post by:
Hello, I have a problem to use databinding with my business layer classes. My data class does not have simple properties (string, int or datetime), instead, all my properties are objects of the...
7
by: Vlado Jasovic | last post by:
Hello, I'm using typed dataset for databinding to windows controls and I'm having some problems. I'm trying to move all business logic to datatable column_changing events and the problem that...
3
by: Peter | last post by:
Hi! I am having some very strange behavior with my databound controls. It's taken a long time to isolate exactly what is provoking the problem, but I'm still leagues away from solving it. I...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.