English 中文(简体)
网址:Radik RadGrid
原标题:Turn php foreach syntax to asp.net using telerik RadGrid

我在协会中写成法典。 该网络和我是新的。 我有两种阵列,一种是姓名,另一种是女婴。

我想制作一个表格,在一栏和两栏中注明姓名,取决于另一栏中的标语(与这一具体名称链接,删除与这一具体名称链接)。

PHP 我这样做:

<table>
 <tr>
  <td>Title</td>
  <td>Actions</td>
 </tr>
 <?php 
  $names = Array("a", "b", "c");
  $ids = Array("1", "2", "3");
  for($i = 0; $i < 3; $i++):
 ?>
  <tr>
   <td>
    <?php echo $names[$i]; ?>
   </td>
   <td>
    <a href="edit.php?id=<?php echo $ids[$i]; ?>">Edit</a>
    <a href="delete.php?id=<?php echo $ids[$i]; ?>">Delete</a>
   </td>
  </tr>
 <?php endforeach; ?>
</table>

我的理解是,你可以在伙伴关系中写出非常相似的内容。 NET,但我必须使用雷达绿色。 非常感谢帮助!

EDIT: If it is important, I get the data as an XML, and I chose to parse it as 2 arrays. If it is easier, I can parse it differently.

最佳回答

雷达绿素是一种蚊帐控制,通常由数据来源控制,然后按计划将不动产改在后面的代码中。

问题回答
<table>
 <tr>
  <td>Title</td>
  <td>Actions</td>
 </tr>
<% string [] names = new string [] {"a", "b", "c"};
string [] ids = new string [] {"1", "2", "3"};
foreach (int i=0;i<names.length;i++)
{
%>
  <tr>
   <td>
<% names[i] %>
   </td>
   <td>
    <a href="edit.php?id=<% ids[i] %>">Edit</a>
    <a href="delete.php?id=<% ids[i] %>">Delete</a>
   </td>
  </tr>
<% } %>
</table>




相关问题
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!

热门标签