There is an invalid sequence in the string. Error problem

P

Patrick.O.Ige

I have this below in a Datalist:-
<asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
DataBinder.Eval(Container.DataItem, "cat_cities")%>'
NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
runat="server" />

But i get error:- Invalid URI: There is an invalid sequence in the string. "
What could be the problem!!!
 
T

Tasos Vogiatzoglou

You should replace <%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'

with

<%#
String.Format("..../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
((DataRowView)Container.DataItem)["mcatid"],
((DataRowView)Container.DataItem)["cat_cities"],
Container.ItemIndex) %>

Regards,
Tasos
 
P

Patrick.O.Ige

I'm getting frustrated with this error i'm using :-
Dim link As String =
String.Format("../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
e.Item.DataItem("mcatid"), e.Item.DataItem("cat_cities"), e.Item.ItemIndex)
Still getting the same error
What could be wrong!!!!!!!!!!!!!!!


Tasos Vogiatzoglou said:
You should replace <%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'

with

<%#
String.Format("..../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
((DataRowView)Container.DataItem)["mcatid"],
((DataRowView)Container.DataItem)["cat_cities"],
Container.ItemIndex) %>

Regards,
Tasos

Patrick.O.Ige said:
I have this below in a Datalist:-
<asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
DataBinder.Eval(Container.DataItem, "cat_cities")%>'
NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
runat="server" />

But i get error:- Invalid URI: There is an invalid sequence in the
string. "
What could be the problem!!!
 
T

Tasos Vogiatzoglou

Could you provide a stacktrace ?
(Btw... the code was in C#, I don't know if it's applicable to VB.NET)

Regards,
Tasos


Patrick.O.Ige said:
I'm getting frustrated with this error i'm using :-
Dim link As String =
String.Format("../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
e.Item.DataItem("mcatid"), e.Item.DataItem("cat_cities"), e.Item.ItemIndex)
Still getting the same error
What could be wrong!!!!!!!!!!!!!!!


Tasos Vogiatzoglou said:
You should replace <%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'

with

<%#
String.Format("..../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
((DataRowView)Container.DataItem)["mcatid"],
((DataRowView)Container.DataItem)["cat_cities"],
Container.ItemIndex) %>

Regards,
Tasos

Patrick.O.Ige said:
I have this below in a Datalist:-
<asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
DataBinder.Eval(Container.DataItem, "cat_cities")%>'
NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
runat="server" />

But i get error:- Invalid URI: There is an invalid sequence in the
string. "
What could be the problem!!!
 
P

Patrick.O.Ige

Tasos thanks i converted it to VB.NET
Actually i had to use ToString() and then used Server.UrlEncode
before i could get some positive result.

Tasos Vogiatzoglou said:
Could you provide a stacktrace ?
(Btw... the code was in C#, I don't know if it's applicable to VB.NET)

Regards,
Tasos


Patrick.O.Ige said:
I'm getting frustrated with this error i'm using :-
Dim link As String =
String.Format("../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
e.Item.DataItem("mcatid"), e.Item.DataItem("cat_cities"),
e.Item.ItemIndex)
Still getting the same error
What could be wrong!!!!!!!!!!!!!!!


Tasos Vogiatzoglou said:
You should replace <%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'

with

<%#
String.Format("..../Showcrete.aspx?CategoryID={0}&CitName={1}&s={2}",
((DataRowView)Container.DataItem)["mcatid"],
((DataRowView)Container.DataItem)["cat_cities"],
Container.ItemIndex) %>

Regards,
Tasos

Patrick.O.Ige wrote:
I have this below in a Datalist:-
<asp:HyperLink id="Hyperlink1" Cssclass="MenuUnselected" Text='<%#
DataBinder.Eval(Container.DataItem, "cat_cities")%>'
NavigateUrl='<%# "../Showcrete.aspx?CategoryID=" &
DataBinder.Eval(Container.DataItem, "mcatid")& "&CitName=" &
DataBinder.Eval(Container.DataItem, "cat_cities") & "&s=" &
Container.ItemIndex %>'
runat="server" />

But i get error:- Invalid URI: There is an invalid sequence in the
string. "
What could be the problem!!!
 

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,969
Messages
2,570,161
Members
46,709
Latest member
AustinMudi

Latest Threads

Top