Problem with hyperlinks

R

rcoco

Hi all,

I have this big problem with hyperlinks I would appriciate any help
please.
My web site has two datagrids on the same page. And one has a list of
names of the users which are in form of hyperlinks. The second
datagrid is for inserting data, and when a user inserts data I used
'Windows Authentication' for names in one column called Name.
Now this is how it's supposed to work: When any user want to see data
about a particular user it's a matter of selecting his name and the
data about the selected individual should be the only ones to be
shown.
I got some examples on Google but they all seem not to be working.
Tha's why I'm here for help please!
Here is where I've reached:
<ItemTemplate> <asp:HyperLink id="HyperLink2" runat="server"
Text='<%#DataBinder.Eval(Container.DataItem,"TeamOperation")%>'
NavigateUrl='<%#"../Dash_Board/DashBoard.aspx?
Name="+DataBinder.Eval(Container.DataItem,"TeamOperation")%>'>H
yperLink
</asp:HyperLink>
</ItemTemplate>
I really appriciate all the help.
Thanks.
 
J

Javier Romero

Hi...

you can do this in the code behind too... and I choose that option always...

something like that:

1. Declare de EventHandler for the Repeater or Grid or wathever in the
OnInit Method:
rptSomething.ItemDataBound += new
RepeaterItemEventHandler(OnRptSomethingDataBound);
// must work also with datagrids, just find the right EventHandler.

2. Make the method that handles this event and search for the control, the
data item, and put the properties that you want.

protected void OnRptSomethingDataBound (object sender,
RepeaterItemEventArgs e)
{
if (args.Item.ItemType == ListItemType.Item || args.Item.ItemType ==
ListItemType.AlternatingItem)
{
//Find the DataItem
SomeObject object = e.Item.DataItem as SomeObject;
//Validate
if (object != null)
{
//Search for the hyperlink control
HyperLink link = (HyperLink)e.Item.FindControl("HyperLink2");
//Validate
if (link != null)
{
link.Text = object.TeamOperation.ToString();
link.NavigateUrl =
string.Format("../Dash_Board/DashBoard.aspx?Name={0}",object.TeamOperation);
}
}
}
}


I hope this helps to you

Javier Romero A, MCAD
http://javier-romero.com
Temperamental .NET Developer
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,483
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top