简体   繁体   English

数据网格 asp.net 中的超链接列

[英]hyperlink column in datagrid asp.net

I have 3 columns in my DataGrid : a Problem id , Solution and Hyperlink .我的DataGrid中有 3 列: Problem idSolutionHyperlink

I want that hyperlink to redirect to a new window with a parameter ProblemId .我希望该超链接重定向到带有参数ProblemId 的新 window And also the size of new window should be small.而且新的 window 的尺寸应该很小。

Thanks Kumar谢谢库马尔

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 command id as the ProblemId and Command Name as HyperLink(or the name u want)将命令 id 作为 ProblemId,将命令名称作为 HyperLink(或您想要的名称)

and in rowCommand Event并在 rowCommand 事件中

check e.commandName=="HyperLink"检查 e.commandName=="HyperLink"

then do what ever u want in java script然后在 java 脚本中做任何你想做的事

ressponse.write(window.open('http://www.domain.com','','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.更多阅读是首选。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM