关于在后台写Gridview的超级连接问题(有点难度) 我在页面上创建咯一个Gridview,并且为其添加一个新列,(类型HyperLinkField)现在有一个问题是,我在后台如何为这个新列动态添加超级连接(DataNavigateUrlFormatString) 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 用脚本也可以实现啊htmlfunction winopen(param){ ......连接页}HyperLinkField.Attributes.Add("onclick", "winopen('43433')"); 有难度么?没看出来..........ItemDataBound的时候赋值不行? 说错了,是RowDataBound 事件.从第2个参数的Row 属性中获取对该行的引用,然后得到你需要的参数,再赋值就行了 可以在ROWCREATED事件中指定。 protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e) { if (e.Row.RowType = DataControlRowType.DataRow) { ...do.. } } 我想知道Gridview的超级连接是那个参数? <asp:TemplateField> <ItemTemplate> <asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "~/SystemManager/EmployeeQuery/UserSettingEdit.aspx?id="+Eval("EmployeeID") %>'>编辑用户设置</asp:HyperLink> </ItemTemplate> </asp:TemplateField> 谢谢楼上,我的意思是在.CS页面如何引用?比如我在前台定义咯一个超级连接<asp:HyperLink ID="HyperLink1" runat="server">HyperLink</asp:HyperLink>那么我可以在后台这么引用 HyperLink1.Text = "asdbad";我现在碰到的问题是我在页面上创建咯一个Gridview,并且为其添加一个新列,(类型HyperLinkField)如何在后台如何为这个新列动态添加超级连接(DataNavigateUrlFormatString) <asp:TemplateField> <ItemStyle HorizontalAlign="Center" /> <ItemTemplate> <asp:HyperLink ID="HyperLinkEdit" runat="server" NavigateUrl='<%# Eval("SingerID", "SingerEdit.aspx?SingerID={0}") %>' Text="编辑"></asp:HyperLink> </ItemTemplate> </asp:TemplateField> protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) { if (e.Row.RowType == DataControlRowType.DataRow) { string SingerID = GridView1.DataKeys[e.Row.RowIndex][0].ToString(); try { HyperLink HyperLinkEdit = (HyperLink)e.Row.FindControl("HyperLinkEdit"); HyperLinkEdit.NavigateUrl = "SingerEdit.aspx?SingerID=" + SingerID + "&sex=" + strsex; } catch { } } } FckEditor的问题 一个关于界面的小问题。。。。。。 如何实现网页抓取呀 请问asp高手和asp.net高手一个问题 ! ASP.NET URL重写问题 我安装了IIS,并配置好了,但还是运行不了ASP页面,它会报一个文件下载安全警报的对话框,这是怎么回事?请帮忙解决一下,谢谢 跪求rdlc报表导出word报错问题 为什么每次控件的事件发生,网页的布局都要改变? 讨论:ASP.NET多项目管理及代码重用问题 如何在网页上嵌入Excel? 小弟求救,如何把两个ASP.NET源程序合并为1个 Session丢失的解决办法?
html
function winopen(param)
{
......连接页
}
HyperLinkField.Attributes.Add("onclick", "winopen('43433')");
protected void GridView1_RowCreated(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType = DataControlRowType.DataRow)
{
...do..
}
}
<ItemTemplate>
<asp:HyperLink ID="HyperLink1" runat="server" NavigateUrl='<%# "~/SystemManager/EmployeeQuery/UserSettingEdit.aspx?id="+Eval("EmployeeID") %>'>编辑用户设置</asp:HyperLink> </ItemTemplate>
</asp:TemplateField>
我的意思是在.CS页面如何引用?
比如我在前台定义咯一个超级连接
<asp:HyperLink ID="HyperLink1" runat="server">HyperLink</asp:HyperLink>那么我可以在后台这么引用
HyperLink1.Text = "asdbad";我现在碰到的问题是
我在页面上创建咯一个Gridview,并且为其添加一个新列,(类型HyperLinkField)
如何在后台如何为这个新列动态添加超级连接(DataNavigateUrlFormatString)
<ItemStyle HorizontalAlign="Center" />
<ItemTemplate>
<asp:HyperLink ID="HyperLinkEdit" runat="server" NavigateUrl='<%# Eval("SingerID", "SingerEdit.aspx?SingerID={0}") %>'
Text="编辑"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
string SingerID = GridView1.DataKeys[e.Row.RowIndex][0].ToString();
try
{
HyperLink HyperLinkEdit = (HyperLink)e.Row.FindControl("HyperLinkEdit");
HyperLinkEdit.NavigateUrl = "SingerEdit.aspx?SingerID=" + SingerID + "&sex=" + strsex;
}
catch
{
}
}
}