Asp.net routing

Hi Im trying to achiveing asp.net vs 2010 routing in vb.net in the datagrid
 I have added the template
<ItemTemplate>
<asp:HyperLink ID="HyperLink7" runat="server"
         NavigateUrl='<%# Eval("ID","List/{0}") %>'
         Text='<%# Eval("ID") %>'>
        </asp:HyperLink>
</asp:HyperLink>

When i click on the hyperlink.. it is redirecting to http://localhost:3201/Admin/Manufacturer/List/6 (says The resource cannot be found.)

how do i caputure the value in the List.aspx, especially the Id


I did not add anything on global.asax

your help is appreciated.. thanks
bsarahimAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Kernel_DCommented:
I would recommend moving your eval statement to the code-behind. In your Page_Load, have some statement such as...

HyperLink7.NavigateUrl = Eval("ID","List/{0}");

Then you can place a breakpoint on that line and find out what is happening.
0
bsarahimAuthor Commented:
sorry Im using a Gridview control. not the datagrid. im not sure, why should i write Code..and do debug..

looking for a full solution.. thanks

0
bsarahimAuthor Commented:
still waiting for the solution..
0
Cloud Class® Course: Amazon Web Services - Basic

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

CodeCruiserCommented:
>When i click on the hyperlink.. it is redirecting to http://localhost:3201/Admin/Manufacturer/List/6 

Where do you expect it to redirect you?
0
bsarahimAuthor Commented:
I want to display the list of the products for the value of 6
0
CodeCruiserCommented:
Where is that page which does this?
0
bsarahimAuthor Commented:
i want to build a detail page(still not started), which shows value of 6 (Manufacture) - product details..
actually im new routing.. how can i code it.. thanks

0
bsarahimAuthor Commented:
Hi
routing is not working

i have add this in the gridview

 <a href="<%:page.GetRouteUrl("ProductDetails", DBNull.Value)%>/<%# Eval("ProductId") %>">product details</a>
and i have added this in global.asax
routes.MapPageRoute("ProductDetails", "Products/{ProductId}", "~/Productdetails.aspx")


When i click the product details it goes to

http://localhost:3201/1

but i dont see it is redirecting to productdetails.aspx, so that i can caputure the productid querystring..

any help will be appreciated and this can be closed



0
CodeCruiserCommented:
Have you done configuration correctly? Are you relative URLs correct?

http://deepumi.wordpress.com/2010/02/27/url-routing-in-asp-net-web-forms/
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
bsarahimAuthor Commented:


in global.asax


Imports System.Web.Routing

Sub RegisterRoutes(ByVal routes As RouteCollection)
 routes.MapPageRoute("ProductDetails", "Products/{ProductId}", "~/Productdetails.aspx")

 End Sub

Sub Application_Start(ByVal sender As Object, ByVal e As EventArgs)
        ' Fires when the application is started

        RegisterRoutes(RouteTable.Routes)


    End Sub
0
CodeCruiserCommented:
I was asking about web.config and the URLs that you are using in register routes.
0
bsarahimAuthor Commented:
this my web.config, pls let me know, what should i do? thanks



<system.web>
            <compilation debug="true" strict="false" explicit="true" targetFramework="4.0">
                  <assemblies>
                        <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
                        <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>
                        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/></assemblies></compilation>
            <authentication mode="Forms">
                  <forms loginUrl="~/Account/Login.aspx" timeout="2880"/>
            </authentication>
            <membership>
                  <providers>
                        <clear/>
                        <add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/"/>
                  </providers>
            </membership>
            <profile>
                  <providers>
                        <clear/>
                        <add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/"/>
                  </providers>
            </profile>
            <roleManager enabled="false">
                  <providers>
                        <clear/>
                        <add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/"/>
                        <add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/"/>
                  </providers>
            </roleManager>
      </system.web>
      <system.webServer>
            <modules runAllManagedModulesForAllRequests="true"/>
      </system.webServer>
0
CodeCruiserCommented:
System.Windows.Forms? Why have you added that?

I dont see any

<httpModules>
<add name=”UrlRoutingModule” type=”System.Web.Routing.UrlRoutingModule,System.Web.Routing,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35¿ />

OR

<system.webServer>
<modules>
<remove name=”UrlRoutingModule” />
<add name=”UrlRoutingModule” type=”System.Web.Routing.UrlRoutingModule,System.Web.Routing,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35¿ />
</modules>
<handlers>
<add name=”UrlRoutingHandler” preCondition=”integratedMode” verb=”*” path=”UrlRouting.axd” type=”System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” />
</handlers>
</system.webServer>
0
bsarahimAuthor Commented:
i have removed the System.Windows.Forms.. im not sure how it add...

and i added

<system.webServer>
<modules>
<remove name=”UrlRoutingModule” />
<add name=”UrlRoutingModule” type=”System.Web.Routing.UrlRoutingModule,System.Web.Routing,Version=3.5.0.0,Culture=neutral,PublicKeyToken=31BF3856AD364E35¿ />
</modules>
<handlers>
<add name=”UrlRoutingHandler” preCondition=”integratedMode” verb=”*” path=”UrlRouting.axd” type=”System.Web.HttpForbiddenHandler, System.Web, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a” />
</handlers>
</system.webServer>


but still it is not working? Thanks
0
bsarahimAuthor Commented:
i have created new project.. in that project the routing is working fine..

and i copied the webconfig from that file in to this current project... The routing is still not working..

any ideas.. what should i do to work routing.. Thanks
0
bsarahimAuthor Commented:
any help will be appreciated
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP.NET

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.