Help! asp.net need js for HyperLink variable

Discussion in 'Javascript' started by Brock, Jul 2, 2008.

  1. Brock

    Brock Guest

    I didn't know a better way to label my subject! Sorry guys... I have
    an ASP.net Datagrid. What I'll be using this for is for a user to
    choose an employee record on the datagrid then hit the detail button
    or link and launch a new window showing the details for that specific
    employee. The new window will have to pick up the Employee ID and
    populate the new ASP.net window. Unfortunately I'm using .net
    Framework 1.1 so my user tools are limited. So I'm thinking why not
    just use Javascript like other people have told me.

    I've tried two ASP ideas of which I couldn't get rid of the errors:

    1):
    <Columns>
    <asp:TemplateColumn>
    <ItemTemplate>
    <asp:HyperLink ID="ViewDetails" Runat="server" NavigateUrl='<%#
    Eval("id","Details.aspx?id={0}") %>'>Details</asp:HyperLink>
    </ItemTemplate>
    </asp:TemplateColumn>
    </Columns>

    2):

    <%@ Page Language="vb" AutoEventWireup="false"
    Codebehind="MainDepartment.aspx.vb"
    Inherits="Forsyth.HR_ReportingTool.UI.MainDepartment" %>
    <FORM id="Form1" method="post" runat="server">
    <asp:datagrid id="dgEmployees" >
    <Columns>
    <asp:TemplateColumn>
    <ItemTemplate>
    <asp:LinkButton ID="ViewDetails" CommandArgument='%# Eval("id") %'
    Runat="server" OnCommand="ViewDetails">Details</asp:LinkButton>
    </ItemTemplate>
    </asp:TemplateColumn>
    </Columns>
    </asp:datagrid></FORM>
    </BODY>
    </HTML>

    Note that in this solution I'm using a "code-behind" file containing:

    Protected Sub ViewDetails(ByVal source As Object, ByVal e As
    System.Web.UI.WebControls.CommandEventArgs)
    Response.Redirect("Details.aspx?id=" & e.CommandArgument.ToString())
    End Sub
     
    Brock, Jul 2, 2008
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. wazoo
    Replies:
    2
    Views:
    5,454
    wazoo
    Oct 24, 2003
  2. Jack Black
    Replies:
    2
    Views:
    467
    Jack Black
    Sep 11, 2004
  3. davetichenor
    Replies:
    1
    Views:
    909
    Eliyahu Goldin
    Oct 30, 2006
  4. Ken
    Replies:
    1
    Views:
    427
    Alvin Bruney
    Aug 16, 2003
  5. Dave
    Replies:
    0
    Views:
    998
Loading...

Share This Page