admin管理员组

文章数量:1417461

I have 3 columns in my DataGrid: a Problem id, Solution and Hyperlink.

I want that hyperlink to redirect to a new window with a parameter ProblemId. And also the size of new window should be small.

Thanks Kumar

I have 3 columns in my DataGrid: a Problem id, Solution and Hyperlink.

I want that hyperlink to redirect to a new window with a parameter ProblemId. And also the size of new window should be small.

Thanks Kumar

Share Improve this question edited May 2, 2011 at 5:45 Akram Shahda 14.8k5 gold badges47 silver badges67 bronze badges asked May 2, 2011 at 5:30 kumarkumar 232 silver badges5 bronze badges 2
  • So, what problems do you have with doing that? What is your question? – Oded Commented May 2, 2011 at 5:35
  • You want to open popup window by clicking the hyperlink? – Waqas Raja Commented May 2, 2011 at 5:40
Add a ment  | 

3 Answers 3

Reset to default 2

Try this:

 <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False">           
            <Columns>
                <asp:BoundField DataField="ProblemID" />
                <asp:HyperLinkField DataNavigateUrlFields="ProblemID" DataNavigateUrlFormatString="SmallWindow.aspx?id={0}"
                    DataTextField="Click here" NavigateUrl="SmallWindow.aspx" />
                <asp:BoundField DataField="Solution" />
            </Columns>
        </asp:GridView>

You can use template field and Row Command Method with the use of

give mand id as the ProblemId and Command Name as HyperLink(or the name u want)

and in rowCommand Event

check e.mandName=="HyperLink"

then do what ever u want in java script

ressponse.write(window.open('http://www.domain.','','scrollbars=no,menubar=no,height=600,width=800,resizable=yes,toolbar=no,location=no,status=no'));

Reading is what you need.

More Reading is preferred.

本文标签: chyperlink column in datagrid aspnetStack Overflow