anjelinio:
Δεν έχω κάνει λάθος στην σύνταξη, αλλά όπως φαίνεται το .NET δεν αφήνει να κάνεις evaluate μέσα σε διάφορα tags.
Το δοκίμασα και μέσα στο ID, αλλά και παλί τίποτα.
Τελικά το έφτιαξα, κάνοντας evaluate μέσα σε ένα tag που το ονόμασα itemid:
<a id="A1" itemid='<%# Eval("ItemID") %>' runat="server" onclick='ShowSelectedItem(this);' href="#">Show</a>
Οπότε τώρα η ShowSelectedItem γίνεται:
function ShowSelectedItem(item)
{
var attribs = item.attributes;
for(var i = 0 ; i < attribs.length ; i++)
{
if(attribs

.nodeName == 'itemid')
{
window.open('ShowItem.aspx?itemid=' + attribs

.value, 'Sell It - Selected Item', 'height=440, width=440');
}
}
}
Αυτό που ουσιαστικά γίνεται είναι να γεμίζονται τα tags itemid των <a> του GridView, με το ItemID και μέσα στην ShowSelectedItem να διαλέξω το itemid και να το στέλνω στο URL.
Με ποιά λογική δεν αφήνει το .NET να κάνεις evaluate μέσα σε κάποια tags, όπως άλλες γλώσσες (php, asp κτλ)?
Parser Error
Description: An
error occurred during the parsing of a resource required to service
this request. Please review the following specific parse error details
and modify your source file appropriately.
Parser Error Message: The
ID property of a control can only be set using the ID attribute in the
tag and a simple value. Example: <asp:Button runat="server"
id="Button1" />
Αν κάποιος έχει καμιά άλλη ιδέα, ας την στείλει παρακαλώ!