Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7558797
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T12:27:54+00:00 2026-05-30T12:27:54+00:00

Using c#, .net, Visual Studio 2010 I have a situation when a user clicks

  • 0

Using c#, .net, Visual Studio 2010

I have a situation when a user clicks on Hyperlink on the gridview the navigationurl should be created on the fly using steps
1 calling webservice and passing few values and receive new idkey which needs to be attached to the navigation url of the control, i can get this done under RowDataBound event, but it will make waste calls to webservice for each row in the grid. Instead i want this to be done when the user clicks the link??

another idea i can think of is using a page in between fill page saying redirecting, but that needs to be auto submit?? any clue on this??? or better way of doing??

Thanks

     <asp:GridView ID="GridViewLinkedService" runat="server" AutoGenerateColumns="False" DataKeyNames = "applicationId"
                DataSourceID="ObjectDataLinkedService" Height="213px"  Width="897px">
                <Columns>
                  <asp:BoundField DataField="applicationId" HeaderText="Application ID"  Visible ="true" 
                        SortExpression="applicationId">
                         <HeaderStyle BackColor="#4B6C9E" BorderStyle="Solid" Font-Bold="True" 
                        Font-Names="Verdana" Font-Size="Small" ForeColor="White" />
                    <ItemStyle Width="10px" />
                        </asp:BoundField>
                    <asp:BoundField DataField="referenceNumber" HeaderText="Reference Number" 
                        SortExpression="referenceNumber"  >
                    <HeaderStyle BackColor="#4B6C9E" BorderStyle="Solid" Font-Bold="True" 
                        Font-Names="Verdana" Font-Size="Small" ForeColor="White" />
                    <ItemStyle Width="30px" />
                    </asp:BoundField>
                    <asp:BoundField DataField="applicationName" HeaderText="Application Name" 
                        SortExpression="applicationName" >
                          <HeaderStyle BackColor="#4B6C9E" BorderStyle="Solid" Font-Bold="True"  Font-Names="Verdana" Font-Size="Small"  ForeColor="White"/>
                        </asp:BoundField>                       
                    <asp:BoundField DataField="address" HeaderText="Address" 
                        SortExpression="address" >
                            <HeaderStyle BackColor="#4B6C9E" BorderStyle="Solid" Font-Bold="True"  Font-Names="Verdana" Font-Size="Small"  ForeColor="White" />
                        </asp:BoundField>

                </Columns>

Hyperlink column is added in the Pageload

  HyperLinkField LinksBoundField = new HyperLinkField();
            string[] dataNavigateUrlFields = {"link"};
            LinksBoundField.DataTextField = "link";
            LinksBoundField.DataNavigateUrlFields = dataNavigateUrlFields;
**LinksBoundField.NavigateUrl; //call webservice(send appid and refno) and append newtoken to url (reieved from datasource link)**
            LinksBoundField.DataNavigateUrlFormatString = "http://" + Helper.IP + "/" + Helper.SiteName + "/" + Helper.ThirdPartyAccess + "?value={0}&token=" + Session["Token"]; 
            LinksBoundField.HeaderText = "Link";
            LinksBoundField.Target = "_blank";          
                  GridViewLinkedService.Columns.Add(LinksBoundField);    
               GridViewLinkedService.RowDataBound += new GridViewRowEventHandler(grdView_RowDataBound);
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-30T12:27:55+00:00Added an answer on May 30, 2026 at 12:27 pm

    deleted the datanavigation code

      string[] dataNavigateUrlFields = {"link"};                LinksBoundField.DataTextField = "link";                LinksBoundField.DataNavigateUrlFields = dataNavigateUrlFields; 
    

    Changed to below url passed with grdviewLink.NavigateUrl does not get jumbled up.

     <asp:HyperLinkField DataTextField="link" HeaderText="Multi-Link" Target="_blank" ItemStyle-Width = "5px" ItemStyle-Wrap ="true">
                         <HeaderStyle  Wrap="True" Width="5px"  BackColor="#4B6C9E" BorderStyle="Solid" Font-Bold="True"   Font-Names="Verdana"   ForeColor="White"/>
    
                        </asp:HyperLinkField>    
    
     protected void grdView_RowDataBound(object sender, GridViewRowEventArgs e)
            {
                string strvalue = "";         
                string strRef = "";
                string strAppId = "";
                foreach (GridViewRow row in GridViewLinkedService.Rows)
                {
                    if (row.RowType == DataControlRowType.DataRow)
                    {  //reference and appid
                        strAppId = row.Cells[0].Text;
                        strRef = row.Cells[1].Text;
                        HyperLink grdviewLink = (HyperLink)row.Cells[6].Controls[0];
                        strvalue = grdviewLink.Text;
                        grdviewLink.NavigateUrl = "~/My Service/Navigate.ashx?AppID=" + strAppId.ToString() + "&Ref=" + strRef.ToString() + "&nurl=" + Server.UrlEncode(strvalue);
    
                    } 
                }
            }
    

    Navigate.ashx file

    public void ProcessRequest(HttpContext context)
            {
                if (context.Request.QueryString.GetValues("AppID") != null)
                {
                    appid = context.Request.QueryString.GetValues("AppID")[0].ToString();
                }
    
                if (context.Request.QueryString.GetValues("Ref") != null)
                {
                    refno = context.Request.QueryString.GetValues("Ref")[0].ToString();
                }
    
                if (context.Request.QueryString.GetValues("nurl") != null)
                {
    
                    nurl = HttpUtility.UrlDecode(context.Request.QueryString.GetValues("nurl")[0].ToString());
                }
    

    this works very well

    Thanks to Curt got the tip of using ashx file instead of aspx from here

    ashx

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have created an office shared add in using Visual Studio 2010 .NET 4.0.
I'm currently using Visual Studio 2010 and have created a 'ASP.NET MVC 3 Web
Using VB.NET in Visual Studio 2010, I have two files: test2.aspx and test2.aspx.vb. The
I have Visual Studio 2010 on Windows 7. My project is using the .net
I have converted text to Image(.png) using ASP.NET C# in Visual Studio 2010. But
I'm using asp.net(C#) under visual studio 2010 I have a panel that is by
I am using Visual Studio 2010, C# .NET 4.0. I have 3 forms: Form1,
I'm using Visual Studio 2010 RTM with .NET/Entity Framework 4 RTM with a model
I'm using the Visual Studio 2010 RC for .NET 4.0 and I'm trying to
I have CruiseControl.net running Visual Studio (2005/2008 - using devenv.com) as we need to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.