当前上下文中不存在名称“Bind” [英] The name 'Bind' does not exist in the current context

查看:195
本文介绍了当前上下文中不存在名称“Bind”的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好,请你帮我解决这个问题。我试图将gridview中一行的id传递给另一个页面,但是我有这个错误,请你帮我。这个概念是当我单击以查看特定行的详细信息时,它应该重定向到另一个页面,具有我将用于获取数据库中数据的行的id。这是代码。谢谢



 <   asp:TemplateField  >  
< ItemTemplate >
< asp:LinkBut​​ton ID = LinkBut​​tonView runat = server < span class =code-attribute> PostBackUrl =' <% 〜/ Web_Pages / Details?PropertyId = + Bind( PropertyId%> ' > 查看< / asp:LinkBut​​ton >
< / ItemTemplate > ;
< / asp:TemplateField >

解决方案

尝试如下...

< asp:LinkBut​​ton ID =LinkBut​​tonViewrunat =serverPostBackUrl =〜/ Web_Pages / Details?PropertyId =+'<%#Bind(PropertyId)%>'> View< / asp:LinkBut​​ton> 



调整必要时引用。


如果Tadit解决方案不起作用,试试这个..

 <   asp:linkbutton     id   =  LinkBut​​tonView    runat   =  server    postbackurl   =  <% #Eval(  PropertyId  〜/ Web_Pages / Details?PropertyId = {0})%>      > 查看<   / asp:linkbutton  >  


用<%#Bind替换Bind(PropertyId) (PropertyId)%>并检查...



希望,您的问题将得到解决..


Hi, can you please help me to solve this problem. I am trying to pass the id of a row in a gridview to another page, but I am having this error, could you please help me. The concept is that when I click to view the details of a particular row, it should redirect to another page, by having the id of the row that I will use to fetch the data in database. Here is the code. Thank you

<asp:TemplateField>
                        <ItemTemplate>
                            <asp:LinkButton ID="LinkButtonView" runat="server" PostBackUrl='<%# "~/Web_Pages/Details?PropertyId="+ Bind("PropertyId") %>'>View</asp:LinkButton>
                        </ItemTemplate>
                    </asp:TemplateField>

解决方案

Try like below...

<asp:LinkButton ID="LinkButtonView" runat="server" PostBackUrl="~/Web_Pages/Details?PropertyId=" + '<%# Bind("PropertyId") %>'>View</asp:LinkButton>


Adjust the quotes if necessary.


if Tadit solution doesn't works, try this..

<asp:linkbutton id="LinkButtonView" runat="server" postbackurl=" <%# Eval("PropertyId", "~/Web_Pages/Details?PropertyId={0}") %>"  >View</asp:linkbutton>


Replace Bind("PropertyId") with <%# Bind("PropertyId") %> and check...

Hope, your problem will be Resolved..


这篇关于当前上下文中不存在名称“Bind”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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