473,383 Members | 1,748 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,383 software developers and data experts.

is not a valid identifier

I have an image button control within a repeater control.

<asp:ImageButton id='<%# Container.DataItem("ProductID")%>' runat="server"
ImageUrl="images/noimage.gif" OnClick="RemoveItem" Autopostback="true"/>

but i'm coming up with the error
"<%# Container.DataItem("ProductID")%>' is not a valid identifier"

how else would i access the ID or value to identify this button control from
any of the repeat items in the repeater control.

any help would be great thanks.
m.
Nov 17 '05 #1
2 9241
Marc,

The code you're showing is processed server side. The id you are trying to
set dynamically is what the server uses to identify the control to the
code-behind page. (The same one that appears at the bottom of the properties
window in the design time view if you're using visual studio.net.)

This would, of course, throw an error since the server is looking for the
name of the control. What you want to set is the control's client id.

Sincerely,

--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Marc Bishop" <no******************@hotmail.com> wrote in message
news:PZ************@news-binary.blueyonder.co.uk...
I have an image button control within a repeater control.

<asp:ImageButton id='<%# Container.DataItem("ProductID")%>' runat="server"
ImageUrl="images/noimage.gif" OnClick="RemoveItem" Autopostback="true"/>

but i'm coming up with the error
"<%# Container.DataItem("ProductID")%>' is not a valid identifier"

how else would i access the ID or value to identify this button control from any of the repeat items in the repeater control.

any help would be great thanks.
m.

Nov 17 '05 #2
Marc,

To answer the second part of your question (finding which button posted
back) I'm going to direct you to some sample code. If you go to my web site,
www.aboutfortunate.com, and then use the search box in the code library to
search for: "which checkbox clicked in datagrid" you'll find an article
titled: "How to reference a checkbox, radiobutton, etc. in a datagrid"

The sample code listed there will show you what you need to do. Doing this
in a datagrid is almost exactly the same as doing it in a repeater.

If you have trouble with it at any point feel free to email me.

Sincerely,
--
S. Justin Gengo, MCP
Web Developer

Free code library at:
www.aboutfortunate.com

"Out of chaos comes order."
Nietzche
"Marc Bishop" <no******************@hotmail.com> wrote in message
news:PZ************@news-binary.blueyonder.co.uk...
I have an image button control within a repeater control.

<asp:ImageButton id='<%# Container.DataItem("ProductID")%>' runat="server"
ImageUrl="images/noimage.gif" OnClick="RemoveItem" Autopostback="true"/>

but i'm coming up with the error
"<%# Container.DataItem("ProductID")%>' is not a valid identifier"

how else would i access the ID or value to identify this button control from any of the repeat items in the repeater control.

any help would be great thanks.
m.

Nov 17 '05 #3

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

Similar topics

16
by: Justin Koivisto | last post by:
OK, on my quest to get one PHP site that is actually valid XHTML 1.0 (strict)... PHP 4.3.8: session.use_trans_sid=1 What is happening is the validator (that doesn't use cookies) sees things...
11
by: Phil Amey | last post by:
In a web based form I am able to make sure that there is text in an input field but I want to force the user into inputting a valid email address, one that has @ in the address How can I modify...
38
by: Jukka K. Korpela | last post by:
As well all know, valid markup is important... but when trying to find a convincing modern argument in favor of this, I found pages like http://www.htmlhelp.com/tools/validator/reasons.html which...
8
by: Petter Reinholdtsen | last post by:
I ran into a problem on HP-UX 11.00 the other day, where it refused to compile a program using 'using namespace std;' at the top. The reason seem to be that the compiler refuses to accept 'using...
64
by: jrefactors | last post by:
Since C is a subset of C++, so any C code or C libraries (printf(), scanf(), etc...) are valid C++ code. Is that correct? so even though the whole program is written in C, but with .cpp...
5
by: Sriram Rajagopalan | last post by:
Hi, Is the extra comma at the end of an enumerator-list valid according to the C standards? With the gcc compiler the following is valid: enum DAYS {MONDAY, TUESDAY, }day1; gcc does not...
3
by: Sfj | last post by:
Hello folks, Old programmer learning new tricks. I think similar issues have been posted, but I would like to ask some help with the following code... select , as ,, from as t1 left outer...
3
by: Marek Zgadzaj | last post by:
I've got the following warning: "The class name '?' is not a valid identifier for this language. " I could not find what is the reason of this warning because the line/column number are 0. There...
11
by: Kurda Yon | last post by:
Hi, I got this warning: mysql_query(): 4 is not a valid MySQL-Link resource. The line which cause this warning is: mysql_query("insert into $tablename (id,priority) values('$id', '0.00')",...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
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...

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.