kumar
kumar

Reputation: 23

hyperlink column in datagrid asp.net

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

Upvotes: 2

Views: 4340

Answers (3)

Vir
Vir

Reputation: 1354

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

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

and in rowCommand Event

check e.commandName=="HyperLink"

then do what ever u want in java script

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

Upvotes: 2

pramodtech
pramodtech

Reputation: 6270

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>

Upvotes: 2

Akram Shahda
Akram Shahda

Reputation: 14781

Reading is what you need.

More Reading is preferred.

Upvotes: 1

Related Questions