Click here to Skip to main content
12,752,396 members (35,826 online)
Rate this:
Please Sign up or sign in to vote.
See more: C# ASP.NET
Hello all,

Would appreciate if anyone could help me.

I have two columns in my gridview, 1st column is a templatefield for capturing rownumber of grid and 2nd column is a link button clicking on which i am opening a pop up window.
    <asp:TemplateField HeaderText="RowNum" Visible="false"> 
    <asp:Label ID="lblRowNum" runat="server" Text="<%#Container.
    DataItemIndex + 1>">

    <asp:TemplateField HeaderText="FileName"> 
    <asp:LinkButton ID="btn"  runat="server" Text='<%#Eval("Empid")%>'
    CommandName="Click" OnClientClick='<%# Eval("FileName", "

This works fine however i want to pass text of label(from first column) as querystring of popup window.

Could it be done in codebehind or within of my javascript code which i am calling onclick event of link button.

Thanks in advance
Posted 5-Oct-12 3:38am
Updated 5-Oct-12 4:47am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

This can be done in codebehind the ItemDataBound event.
LinkButton lb = dataItem.FindControl("btn") as LinkButton;
string qString = "abc.aspx?value=" + lb.Text;
 lb.OnClientClick = "
    ('"+qString +"',null,"location=0,status=0,toolbar=0,

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

    Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.170217.1 | Last Updated 5 Oct 2012
Copyright © CodeProject, 1999-2017
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100