使用ASP.NET控件不绑定 [英] Using ASP.NET Controls without databinding

查看:89
本文介绍了使用ASP.NET控件不绑定的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看来,我一直在使用asp.net数据绑定这么长时间我都忘记了一些基本知识。

It appears that I have been using asp.net databinding for so long I have forgotten some of the basics.

我动态创建在ASPX页面的表没有数据绑定。

I am dynamically creating a table in an ASPX page without databinding.

    foreach (XXX x in TTTT){ %>
       <tr>
           <td><%=x.val %></td>
               <asp:ImageButton runat="server" CommandName="uiImgResolve_Click"
               CommandArgument='<%=X.pkid%>' ImageUrl="../images/IMG.png"/>
     <% } %>

正如你很可能会看到我不能使用runat =服务器或者如果我这样做,我不能指定行的ID。这只是一个简单的例子是什么,我试图做的是更加复杂,不利于databiding。在经典ASP,我们以前只是调用JS方法,然后提交表单中嵌入一个隐藏字段的PKID。它有一个更优雅的方式来解决这个问题(我们使用Jquery如果这能帮助)

As you can probably see I cannot use the RUNAT=Server or if I do I cannot specify an id for the row. This is just a simple example what I am attempting to do is much more complex and is not conducive to databiding. In Classic ASP we used to just call a JS method and then submit the form with the PKID embedded in a hidden field. It there a more elegant way to solve this(We are using Jquery if this helps)

正如我所说的,我很熟悉所有的.NET控件以及经常使用它们,在这种情况下是不正确的工具。

AS I said I am VERY familiar with all the .net controls and use them often, in this instance it is not the correct tool.

推荐答案

您可以通过查询字符串传递的参数。

是这样的:

You can pass the parameters by query string.
something like this :

foreach (XXX x in TTTT){ %>
   <tr>
       <td><%=x.val %></td>
           <a href='?Action=Resolve&pkid=<%=X.pkid%>'>
               <img src='../images/IMG.png' />
           </a>
 <% } %>

这篇关于使用ASP.NET控件不绑定的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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