如何将一个页面中的文本框值绑定为另一个页面中gridview中超链接字段的值? [英] How can I bind the value of textbox in one page as the value of the hyperlink field in the gridview in another page?

查看:150
本文介绍了如何将一个页面中的文本框值绑定为另一个页面中gridview中超链接字段的值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我有一个名为的文本框,一页中有一个URL&我在另一页面上有一个gridview。在gridview中有一个名为Reg.No的超链接字段。我希望URL绑定到网格中的Reg.No字段。我的意思是在网格视图中它应该显示reg.no值:

ex:XXXXXXXX。 &安培;当我在网格视图中点击Reg.No时,应该使用在URL字段中输入的链接打开新页面。



如果我输入的URL为www.google.com,当我点击reg.no超链接时,应该打开谷歌页面。



我尝试了什么:



< asp:HyperLinkField DataTextField =REGDataNavigateUrlFields =URLDataNavigateUrlFormatString =〜\ AllllDetail.aspx?URL = {0}

HeaderText =REG#/>

Hi ,

I have textbox named, URL in one page & i have a gridview in another page. in gridview there is a hyperlink field called Reg.No. I want the URL to be bind to the Reg.No field in the grid. I mean in grid view it should show the reg.no value:
ex:XXXXXXXX. & when i click on that Reg.No in grid view, new page should be opened using the link that is entered in the URL field.

If i enter the URL as www.google.com, when i click on the reg.no hyperlink, google page should be opened.

What I have tried:

<asp:HyperLinkField DataTextField="REG" DataNavigateUrlFields="URL" DataNavigateUrlFormatString="~\AllocDetail.aspx?URL={0}"
HeaderText="REG#" />

推荐答案

<asp:TemplateField HeaderText="REG" ItemStyle-HorizontalAlign="Right" >
      <HeaderStyle Width="150px" HorizontalAlign="Center" />
        <ItemTemplate>
          <asp:HyperLink ID="someID" runat="server"                        
            Text='<%# DataBinder.Eval(Container.DataItem,"REG") %>'
            NavigateUrl='<%# "~\AllocDetail.aspx?URL=" + Eval("REG").ToString() %>'>    
          </asp:HyperLink>
        </ItemTemplate>
      </asp:TemplateField>


这篇关于如何将一个页面中的文本框值绑定为另一个页面中gridview中超链接字段的值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆