<asp:GridView ID="grdSent" runat="server" AllowPaging="True" AutoGenerateColumns="False" OnPageIndexChanging="grdSent_PageIndexChanging">
<Columns>
<asp:CommandField ShowDeleteButton="True" />
<asp:BoundField DataField="uniqueID" HeaderText="uniqueID" Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="uniqueID" DataNavigateUrlFormatString="~/BBS/fckeditor.aspx?fck={0}" DataTextField="subject" HeaderText="主题" />
<asp:BoundField DataField="mailFrom" HeaderText="发件人" />
<asp:BoundField DataField="sendTime" HeaderText="发送时间" />
</Columns>
</asp:GridView>
<Columns>
<asp:CommandField ShowDeleteButton="True" />
<asp:BoundField DataField="uniqueID" HeaderText="uniqueID" Visible="False" />
<asp:HyperLinkField DataNavigateUrlFields="uniqueID" DataNavigateUrlFormatString="~/BBS/fckeditor.aspx?fck={0}" DataTextField="subject" HeaderText="主题" />
<asp:BoundField DataField="mailFrom" HeaderText="发件人" />
<asp:BoundField DataField="sendTime" HeaderText="发送时间" />
</Columns>
</asp:GridView>
带多个参数:
<asp:HyperLinkField DataNavigateUrlFields="parentid,id" Text="下级目录" DataNavigateUrlFormatString="productchildren.aspx?pid={0}&id={1}" HeaderText="查看下级目录" />
另一种后台编写方法:[Vegas原创]
<asp:TemplateField HeaderText="表单名称">
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("FORM_NAME") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" Text='<%# Eval("FORM_NAME") %>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
//在不可见之前做很多事情~ ~~~
if (e.Row.RowType == DataControlRowType.DataRow)
{
//链接~
((HyperLink)e.Row.Cells[1].FindControl("HyperLink1")).NavigateUrl = string.Format("javascript:void window.open('http://DTSFLOWER/module/mailroute.aspx?FORM_KIND={0}&FORM_NO={1}&FORM_APPROVE_ID={2}&LOGON_ID={3}&MAIL_TYPE={4}');",
e.Row.Cells[2].Text,e.Row.Cells[0].Text ,e.Row.Cells[3].Text,e.Row.Cells[4].Text,e.Row.Cells[5].Text );
//小提示~
e.Row.Cells[1].ToolTip = "表单号:" + e.Row.Cells[0].Text;
for (int i = 0; i < e.Row.Cells.Count; i++)
{
if (i != 1)
{
e.Row.Cells[i].Visible = false;
}
}
}
}
{
//在不可见之前做很多事情~ ~~~
if (e.Row.RowType == DataControlRowType.DataRow)
{
//链接~
((HyperLink)e.Row.Cells[1].FindControl("HyperLink1")).NavigateUrl = string.Format("javascript:void window.open('http://DTSFLOWER/module/mailroute.aspx?FORM_KIND={0}&FORM_NO={1}&FORM_APPROVE_ID={2}&LOGON_ID={3}&MAIL_TYPE={4}');",
e.Row.Cells[2].Text,e.Row.Cells[0].Text ,e.Row.Cells[3].Text,e.Row.Cells[4].Text,e.Row.Cells[5].Text );
//小提示~
e.Row.Cells[1].ToolTip = "表单号:" + e.Row.Cells[0].Text;
//VISIBLE=FALSE~~~
for (int i = 0; i < e.Row.Cells.Count; i++)
{
if (i != 1)
{
e.Row.Cells[i].Visible = false;
}
}
}
}
相关文章
暂无评论...