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

Identifying calls from anchors

I am busy doing a small application to get myself familiar with asp.net, and I have run into a problem. I have a list of anchors created with a repeater. I need to uniquely identify each anchor when doing a post back so that some data fields can be filled with the appropriate data. I have tried setting the id as follows:

<a href="#" id='<%#GetPhotoKey(Container.DataItem)%>' onserverclick='SelectAnchor_Click' runat="server"><%#GetPhotoTitle(Container.DataItem )%></a>

I get an "invalid identifier" error with the above code. Setting the name this way results in the server-side script being sent to the client.

The only other option I can think of is to reload the page (via the querystring). This brings up an entirely different problem that I would like to avoid if at all possible.

Any help would be greatly appreciated.
Nov 18 '05 #1
2 957
"Paul K" <Pa***@discussions.microsoft.com> wrote in message
news:B5**********************************@microsof t.com...
I am busy doing a small application to get myself familiar with asp.net, and I have run into a problem. I have a list of anchors created with a
repeater. I need to uniquely identify each anchor when doing a post back so
that some data fields can be filled with the appropriate data. I have tried
setting the id as follows:
<a href="#" id='<%#GetPhotoKey(Container.DataItem)%>' onserverclick='SelectAnchor_Click'
runat="server"><%#GetPhotoTitle(Container.DataItem )%></a>
I get an "invalid identifier" error with the above code. Setting the name this way results in the server-side script being sent to the client.
The only other option I can think of is to reload the page (via the querystring). This brings up an entirely different problem that I would
like to avoid if at all possible.
Any help would be greatly appreciated.


Why not use a LinkButton, which has CommandName and CommandArgument
properties? You can arrange to have a different CommandArgument for each
item in the repeater. You can see the CommandArgument when you handle the
Command event of the LinkButton.
--
John Saunders
johnwsaundersiii at hotmail
Nov 18 '05 #2
Thanks for the tip; the link button is exactly what I needed. I didn't really know what the purpose of it was; now I do :)

Thanks!
Nov 18 '05 #3

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

Similar topics

7
by: Ben Wilson | last post by:
To anyone who can help me, you have my thanks in advance. I am implementing a "301 Moved Permanently" redirect in my website due to a change of our domain names. Unfortunately, I am having a...
2
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
1
by: mlv2312 | last post by:
Hi, I have experienced problems when dealing with nested anchors. I implemented some code to perform highlighting and specific anchors are used for the searched words. The problem is when the...
2
by: learner | last post by:
Hi, A document has many Anchors. I want to take a particular action only if some particular anchors are clicked. I mean if some anchors are clicked, i want an alert box to pop up with ok and...
21
by: adrian suri | last post by:
Hi just started to experement with styleshhets, and have defined hover a:hover { Color : red; Text-decoration : none; Border-top-width : medium; Border-right-width : medium;
0
by: Paul K | last post by:
I am busy doing a small application to get myself familiar with asp.net, and I have run into a problem. I have a list of anchors created with a repeater. I need to uniquely identify each anchor...
12
by: Rich | last post by:
Strangely, on-page anchors will work on MSIE, but not on Netscape7.2 or Firefox1.5. All anchors are numbers e.g. <a href="#21">TOPIC</a> supposed to connect down to <a name="#21>beginning of...
3
by: windandwaves | last post by:
does it matter if I write var anchors = document.getElementsByTagName("A"); or var anchors = document.getElementsByTagName("a"); Or is there a better way to catch both <a hrefs and <A...
3
by: beenapatni | last post by:
Hi We need to identify difference between a dropped call and normally ended calls in windows mobile phone Dropped calls: Call diconnected due to no n/w signal, low battery level...etc Normally...
6
by: Andrew Poulos | last post by:
I have this (the name is fixed by the LMS): var API_1484_11 = (function() { // private variables // private methods // public methods return { get : function() {
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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
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...
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
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...

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.