Results 1 to 5 of 5

Thread: How grap the passed value in URL ?

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Talking How grap the passed value in URL ?

    Hi guys i am passing a aspx page with teamno value( teamsandmatchs.aspx?team=2 ) I do not know how i can grap that passed value and place it inside html url. i want the passed value to be placed after teamno=.

    Code:
    p><a href="http://localhost/updatemachrecord/insertmatchviateam.aspx?teamno=">Add Record</a>
    i be happy if some one show me how i put passed value team after ?teamno= in the url.Thanks

    here is my page code
    Code:
    <%@ Page Language="vb" AutoEventWireup="false" Codebehind="teamsandmatches.aspx.vb" Inherits="updatemachrecord.teamsandmatches"%>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
    <HTML>
    	<HEAD>
    		<title>WebFormTeams</title>
    		<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
    		<meta name="CODE_LANGUAGE" content="Visual Basic .NET 7.1">
    		<meta name="vs_defaultClientScript" content="JavaScript">
    		<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
    	</HEAD>
    	<body MS_POSITIONING="GridLayout">
    		<form id="Form1" method="post" runat="server">
    			<asp:DataGrid id="DataGridTeams" style="Z-INDEX: 101; LEFT: 24px; POSITION: absolute; TOP: 64px"
    				runat="server" Width="264px" Height="208px" BorderColor="White" BorderStyle="Ridge" CellSpacing="1"
    				BorderWidth="2px" BackColor="White" CellPadding="3" GridLines="None" PageSize="5" AllowPaging="True">
    				<SelectedItemStyle Font-Bold="True" ForeColor="White" BackColor="#9471DE"></SelectedItemStyle>
    				<ItemStyle ForeColor="Black" BackColor="#DEDFDE"></ItemStyle>
    				<HeaderStyle Font-Bold="True" ForeColor="#E7E7FF" BackColor="#4A3C8C"></HeaderStyle>
    				<FooterStyle ForeColor="Black" BackColor="#C6C3C6"></FooterStyle>
    				<Columns>
    					<asp:ButtonColumn Text="Delete" CommandName="Delete"></asp:ButtonColumn>
    					<asp:HyperLinkColumn Text="Edit" DataNavigateUrlField="MATCHNO" DataNavigateUrlFormatString="http://localhost/updatemachrecord/matchupdateteams.aspx?match={0}"></asp:HyperLinkColumn>
    				</Columns>
    				<PagerStyle HorizontalAlign="Right" ForeColor="Black" BackColor="#C6C3C6" Mode="NumericPages"></PagerStyle>
    			</asp:DataGrid>
    		</form>
    		<p><a href="http://localhost/updatemachrecord/insertmatchviateam.aspx">Add Record</a>
    			<asp:Label id="Label1" style="Z-INDEX: 102; LEFT: 168px; POSITION: absolute; TOP: 16px" runat="server"
    				Height="32px" Width="184px">Matches Record by teams</asp:Label></p>
    	</body>
    </HTML>

  2. #2
    Member Nikhil Aggarwal's Avatar
    Join Date
    Jun 2005
    Location
    New Delhi, India
    Posts
    36

    Re: How grap the passed value in URL ?

    In codebehind the value can be retreived from the request object
    Code:
    Request.QueryString["team"]
    To be able to do this on the client ride reffer to this article
    Click Here

    Nikhil Aggarwal

  3. #3
    I'm about to be a PowerPoster! mendhak's Avatar
    Join Date
    Feb 2002
    Location
    Ulaan Baator GooGoo: Frog
    Posts
    38,170

    Re: How grap the passed value in URL ?

    No need to post multiple times, tony.

  4. #4

    Thread Starter
    Frenzied Member
    Join Date
    Apr 2005
    Posts
    1,907

    Talking Re: How grap the passed value in URL ?

    Quote Originally Posted by Nikhil Aggarwal
    In codebehind the value can be retreived from the request object
    Code:
    Request.QueryString["team"]
    To be able to do this on the client ride reffer to this article
    Click Here

    Thank u for u reply. do u mean should do like this

    Code:
    Request.QueryString["team"]
    
    
    p><a href="http://localhost/updatemachrecord/insertmatchviateam.aspx?teamno=Request.QueryString["team"]">Add Record</a>

  5. #5
    Member Nikhil Aggarwal's Avatar
    Join Date
    Jun 2005
    Location
    New Delhi, India
    Posts
    36

    Re: How grap the passed value in URL ?

    Quote Originally Posted by tony007
    Code:
    p><a href="http://localhost/updatemachrecord/insertmatchviateam.aspx?teamno=Request.QueryString["team"]">Add Record</a>
    I'm presuming you are tring to generate a hyperlink based on a parameter that the page recieves in its querystring.
    Request.QueryString["team"] would work only in the code behind, so you would need to generate the hyperlink in the code behind itself.
    Eg:
    Code:
    <asp:HyperLink id="HyperLink1" runat="server">Add Record</asp:HyperLink>
    VB Code:
    1. Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
    2.         If (Not IsPostBack) Then
    3.             Dim linkurl As New System.Text.StringBuilder
    4.             linkurl.Append("http://localhost/updatemachrecord/insertmatchviateam.aspx?teamno=")
    5.             linkurl.Append(Request.QueryString("teamno").ToString())
    6.             HyperLink1.NavigateUrl = linkurl.ToString()
    7.         End If
    8.     End Sub
    Nikhil Aggarwal

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width