我有一个被填充从datasouce一个GridView。 即填充数据源的存储过程,有一个领域的客户端,并现场客户中的网站。
我想填充领域的客户在GridView列被称为客户端,这将是一个超链接字段和超链接字段是从数据集的客户网站的价值。客户端的网站是外部站点(不在我的ASP项目)
下面是我的html code。我怎样才能获得客户中的网站显示为DataNavigatrURL值?
< ASP:HyperLinkField字段DataTextField =客户HEADERTEXT =客户DataNavigateUrlFields =客户端
DataNavigateUrlFormatString =客户中的网站>
< HeaderStyle HorizontalAlign =中心/>
< ItemStyle HorizontalAlign =左/>
< / ASP:HyperLinkField字段>
解决方案
使用数据绑定的NavigateUrl属性,像这样的:
NavigateUrl ='<%#绑定(ClientWebSite)%>
或者更加充分:
< ASP:HyperLinkField字段DataTextField ='<%#绑定(客户%>'HEADERTEXT =客户NavigateUrl ='<%#绑定(ClientWebSite )%>'>
< HeaderStyle HorizontalAlign =中心/>
< ItemStyle HorizantalAlign =左/>
< / ASP:HyperLinkField字段>
DataNavigateUrlFields
用来获取或设置从用于构造的URL在HyperLinkField字段对象中的超链接数据源字段的名称。
DataNavigateUrlFormatString`用来获取或设置指定了一个HyperLinkField字段对象的超级链接的URL的呈现格式字符串。
I have a gridview that is being populated from a datasouce. The Stored procedure that is populating the datasource, has a field "Client" and a field "Client WebSite".
I want to populate the field "Client" in the gridview column called "Client" which would be a hyperlink field and the hyperlink field would be the "Client WebSite" value from the dataset. The client website is an external site (not within my asp project)
Below is my html code. How can I get the "Client WebSite" appear as the DataNavigatrURL value?
<asp:HyperLinkField DataTextField="Client" HeaderText="Client" DataNavigateUrlFields="Client"
DataNavigateUrlFormatString="Client WebSite">
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizontalAlign="Left" />
</asp:HyperLinkField>
解决方案
Use databinding on the NavigateUrl attribute, like this:
NavigateUrl = '<%# Bind("ClientWebSite") %>'
Or more fully:
<asp:HyperLinkField DataTextField='<%# Bind("Client" %>' HeaderText="Client" NavigateUrl='<%# Bind("ClientWebSite") %>'>
<HeaderStyle HorizontalAlign="Center" />
<ItemStyle HorizantalAlign="Left" />
</asp:HyperLinkField>
DataNavigateUrlFields
is used to gets or set the names of the fields from the data source used to construct the URLs for the hyperlinks in the HyperLinkField object.
'DataNavigateUrlFormatString` is used to gets or sets the string that specifies the format in which the URLs for the hyperlinks in a HyperLinkField object are rendered.
上一篇:无法执行的onSaveInstanceState后(的onClick preference)这个动作动作、onSaveInstanceState、onClick、preference
下一篇:如何停止HttpURLConnection.getInputStream()?HttpURLConnection、getInputStream