English 中文(简体)
Bled GridView to range of strings. 2. 超链接场问题
原标题:Binding GridView to array of strings. Problem with HyperLinkField

我知道,你可以使用挖掘信号,将各种简单类型的(如扼杀)与GredView等联系起来。

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
    <Columns>
       <asp:BoundField HeaderText="Array Field" DataField="!" />
    </Columns>    
</asp:GridView>

但是,在数据导航方面,情况似乎并非如此。 Url Fields

<asp:HyperLinkField DataNavigateUrlFields="!" DataNavigateUrlFormatString="RoleInformation.aspx?role={0}" Text="Manage users" />

我发现以下错误:

名称为`外地或财产'! 选定数据来源没有发现。

最佳回答

大多数人甚至知道使用<条码>!。 我在阅读你的问题时,实际上让我记住我已经读过但从未实际使用的这个特点。 考虑到这一点,我不认为与这种领域有某种关系,因为在超链接现场执行中可能被遗忘了。 你们只能迅速改用指定的财产,然后,你没有问题:

例:

<asp:GridView ID="grdTest" runat="server" AutoGenerateColumns="false"> 
    <Columns> 
        <asp:BoundField HeaderText="Array Field" DataField="data" />
        <asp:HyperLinkField DataNavigateUrlFields="data" DataNavigateUrlFormatString="RoleInformation.aspx?role={0}" Text="Manage users" /> 
    </Columns>     
</asp:GridView>

外地名称<代码>数据。 接着,对你们的阵容进行约束:

string[] testArray = { "1", "2", "3" };
grdTest.DataSource = testArray.Select(a => new { data = a });
grdTest.DataBind();

它没有直接取代<代码>!,但它是一种简单的解决办法,可以绕过对简单阵列具有约束力,即使“<代码>!已经执行,而且可能需要针对每个领域。

问题回答

暂无回答




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Transaction handling with TransactionScope

I am implementing Transaction using TransactionScope with the help this MSDN article http://msdn.microsoft.com/en-us/library/system.transactions.transactionscope.aspx I just want to confirm that is ...

System.Web.Mvc.Controller Initialize

i have the following base controller... public class BaseController : Controller { protected override void Initialize(System.Web.Routing.RequestContext requestContext) { if (...

Microsoft.Contracts namespace

For what it is necessary Microsoft.Contracts namespace in asp.net? I mean, in what cases I could write using Microsoft.Contracts;?

Separator line in ASP.NET

I d like to add a simple separator line in an aspx web form. Does anyone know how? It sounds easy enough, but still I can t manage to find how to do it.. 10x!

热门标签