通过单击gridview控件中的链接列导航到其他页面? [英] Navigate to other page by clicking link column in gridview control ?

查看:93
本文介绍了通过单击gridview控件中的链接列导航到其他页面?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个从后面的代码生成的gridview.我有一个链接栏.当我单击链接列时,我想重定向到另一页.

谢谢,
MB.

I have a gridview generated from code behind. I have a link column. when i click to link column i want redirect to another page.

Thanks,
MB.

推荐答案

有两种方法可以使其起作用.您可以创建HyperLinkField 或在<asp:templatefield >
中添加超链接 看看:
There are two ways you can make it work. You can create either HyperLinkField or add a Hyperlink in <asp:templatefield >
Have a look:
<Columns>
            <asp:HyperLinkField DataTextField="LeadID" DataNavigateUrlFields="LeadID" DataNavigateUrlFormatString="LeadInformation.aspx?LeadID={0}" Text="Lead ID" />
            <asp:BoundField DataField="DateTime" HeaderText="Date Updated" />
            <asp:TemplateField>
                <ItemTemplate>
                    <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl=''<%# Bind("LeadID") + Request.QueryString("type") %>''Text=""></asp:HyperLink>
                </ItemTemplate>
             </asp:TemplateField>
</Columns>>


参考:
在gridview中使用的链接按钮是另一页重定向 [ ^ ]
如何根据特定条件在Grid View中添加动态超链接 [ ^ ]


Refer:
link button using in gridview another page redirect[^]
How to add dynamic hyperlink in Grid View according to certain condition[^]


您好兄弟,请尝试以下代码


Hello dude try this code


<asp:TemplateField >
                  <ItemTemplate>

                  <asp:HyperLink ID="btnredirect" runat="server" Text="Redirect" NavigateUrl="redirectonPagename.aspx"  />
               </ItemTemplate>
                  
              </asp:TemplateField>


这篇关于通过单击gridview控件中的链接列导航到其他页面?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆