模板列行啊,用hyperlink控件。

解决方案 »

  1.   

    用hyperlinkcolumn列来实现,代码如下:
    <asp:HyperLinkColumn DataNavigateUrlField="bh" DataNavigateUrlFormatString="chakan.aspx?bh={0}" DataTextField="mingcheng">
    <HeaderStyle Wrap="False"></HeaderStyle>
    </asp:HyperLinkColumn>
    其中bh和mingcheng是字段
      

  2.   

    ASP页面:
    <Columns>
    <asp:templatecolumn ItemStyle-HorizontalAlign="Center" ItemStyle-Width="6%">
    <itemtemplate> <span>    <%# Container.ItemIndex+1 %> </span>
    </itemtemplate>
    </asp:templatecolumn>
    <asp:BoundColumn DataField="gh_id" Visible="False"></asp:BoundColumn>
    <asp:ButtonColumn ItemStyle-HorizontalAlign="Center" ItemStyle-Width="24%" DatatextField="gh_lb" CommandName="edit"></asp:ButtonColumn>
    <asp:BoundColumn ItemStyle-HorizontalAlign="Center" DataField="gh_jb" ItemStyle-Width="12%"></asp:BoundColumn>
    <asp:BoundColumn ItemStyle-HorizontalAlign="Center" DataField="gh_bj" ItemStyle-Width="58%"></asp:BoundColumn>
    </Columns>后台:
        Private Sub dgr1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgr1.ItemCommand
            If e.CommandName = "edit" Then
                lblgh_id.Text = e.Item.Cells(1).Text
                DataHandle.ReturnBind(pnlDetail, "cg_gh", "gh_id", lblgh_id.Text)
                Ctrlhandle.Enabled(pnlDetail, False)
                Ctrlhandle.ClickButton(pnlTop, ButtonName.imbsave)
                viewstate("State") = "edit"
            End If
        End Sub
      

  3.   

    后台用Class了,可能你看不懂。
      

  4.   

    错了,应该是    Private Sub dgr1_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.DataGridCommandEventArgs) Handles dgr1.ItemCommand
            If e.CommandName = "edit" Then
                Response.Redirect("cg_gs_input.aspx")        End If
        End Sub