Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

accessing a datagrid item in a control

Status
Not open for further replies.

jimberger

Programmer
Jul 5, 2001
222
GB
Hi,

I am trying to use a datagrid value within a asp:hyperlink control

i have

<asp:hyperlink id="DeleteTopic" runat="server" NavigateUrl="editthreads.aspx?did='<%# DataBinder.Eval(Container.DataItem, "MessageID")%> CssClass="side">Delete Topic</asp:hyperlink>


but i get the error message server tag is not well formed.
any ideas?
thanks for your help
jim
 
did you create this line yourself? I belive the problem is thie the dabinder part of the tag.
 
hi the datagrid tag works when i do

<a href="edithreads.aspx?did=<%# DataBinder.Eval(Container.DataItem, "MessageID")%> etc....

but when i use it inside a ASP.NET control i get the error
 
again, are you creating the line yourself, or are you using the properties window of control? The code you put is for a datagrid column, the syntax is different for different other controls.
 
the error means u are using a " inside a "

<asp:hyperlink id="DeleteTopic" runat="server" NavigateUrl="editthreads.aspx?did='<%# DataBinder.Eval(Container.DataItem, "MessageID")%>

i dont know a workaround for this currently...

>>The code you put is for a datagrid column, the syntax is different for different other controls.

can i have an e.g.?

Known is handfull, Unknown is worldfull
 
vbKris

I don't even see container as a choice for databindings.. I am confused now..

The hyperlink binding I am using is:
Text='<%# DataBinder.Eval(DsEmployees1, "Tables[Employees].DefaultView.[0].Name")

I thought container was specific to the DG.. I guess not..

 
>>I thought container was specific to the DG.. I guess not..


yup, it can be used even for a Reapeater control...

Known is handfull, Unknown is worldfull
 
I'm new at this, but you only have one ' mark in your original expression.

I suggest you put the other one in it's proper place.

May not work after you do so, but guaranteed not to work until you do!




David Wendelken
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top