What I'm doing now is listing down a set of result and next to each result, there are some links and this link contains some querystring. But, I got an error when I add a guid as a querystring. The error mesg is:
Operator is not valid for string "updateMobile.aspx?username=60161" and type 'Guid'.
And my code is:
1<asp:TemplateColumn HeaderText="">2<ItemTemplate>3<asp:HyperLink NavigateUrl='<%# "updateMobile.aspx?username=" + DataBinder.Eval(Container.DataItem, "username") + "&UserUID=" + DataBinder.Eval(Container.DataItem, "UserUID")%>' Text="Edit Mobile" runat=server id="lnkEditMobile" /></asp:HyperLink>4</ItemTemplate>5</asp:TemplateColumn>
May I know how to I convert/cast this guid into string?
You can for example use Convert.ToString(DataBinder.Eval(xxxxxxx)) or I also think the ToString method of the returned value of the DataBinder.Eval will work. Instead of using the DataBinder.Eval. You can in ASP.Net 2.0 use the Eval expression:
Eval("username")
Much easier to use, you can alos adda an format expression as an argument to the Eval method.
It works! Big thank you.
0 comments:
Post a Comment