问题与gridview plz有关,请阅读我的cmplt问题 [英] problem is related to gridview plz read my cmplt problem

查看:76
本文介绍了问题与gridview plz有关,请阅读我的cmplt问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的页面上有1个gridview,我希望如果我单击gridview的任何行,那它应该打开另一页怎么办?我应该在行命令事件上工作吗?请告诉我
我希望在运行时单击gridview的任何行后,应将其重定向到另一个具有id的页面,因为该id将被重定向至该页面,并且该页面将获得该id.

i have 1 gridview at my page i want that if i will click on any row of gridview than it should open another page how it can possible?should i do work on the row command event?tell me please
i want that after clicking on any row of gridview at runtime it should redirect to the another page with id because the id will be redirect withit and that page will get that id. and some data will come according to that id on that page.plz tell me how it can be possible?

推荐答案

您完全可以通过三种解决方案来解决问题:
您可以使用下面的模板feild和其中的超链接feild.
You completly three solution to your problem:
You can either use the following template feild with hyperlink feild in it.
<asp:TemplateField>
    <ItemTemplate>
        <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl ='<%# Bind("EmpCode") %>'>GoTo Next Page</asp:HyperLink>
    </ItemTemplate>


或者您可以使用gridview的HyperLinkField


Or You can HyperLinkField of gridview

</asp:TemplateField>
<asp:HyperLinkField DataNavigateUrlFields="Url link database"
        DataTextField="Url Title Feid in database" />
        <asp:ButtonField ButtonType ="Link" CommandName ="NaviagetonextPage" />


或者,您也可以使用行命令事件来显示网格视图的按钮字段:


or you can button field of grid view with on row command event:

<asp:ButtonField ButtonType ="Link" CommandName ="NaviagetonextPage" />


protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
   {
       if (e.CommandName == "NaviagetonextPage")
       {
           NaviagetonextPage();
       }
   }
   public void NaviagetonextPage()
   {

   }


这篇关于问题与gridview plz有关,请阅读我的cmplt问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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