如何创建ImageButtons ASP.NET C#数组

时间:2015-04-23 23:36:35

标签: c# asp.net arrays imagebutton

我在创建ImageButtons数组时遇到问题,并在屏幕上显示它们。

这就是我所做的:

#include <stdio.h>
int main (void)
{    float loan_amount, rate, payment, monthly_amount, interest;
     int t, i=1;
     printf("Enter Loan Amount");

     scanf("%i", &loan_amount);

     printf("Enter Interest rate:");
     scanf("%f", &rate);
     printf("Enter Monthly Payment:");
     scanf("%f", &payment);
     printf("Enter number of payments:");
     scanf("%d",&t);
     while(loan_amount>0;
     {
          interest = loan_amount*rate/12;
          monthly_amount = (loan_amount+interest - payment);
          if(monthly_amount>0)
               printf("Balance remaing after %d payment: $ %.2f\n",i, monthly_amount);
          loan_amount = monthly_amount;
          i++;
     }
     return 0;
}

基本上我已经创建了一个面板,我想要显示我的ImageButton[] aImageButton = new ImageButton[9]; Panel1.Visible = true; for (int i = 0; i <= 9; i++) { aImageButton[i] = new ImageButton(); aImageButton[i].ID = "ImageButton" + (i + 1); aImageButton[i].Width = 100; aImageButton[i].Height = 100; aImageButton[i].BorderWidth = 0; aImageButton[i].ImageUrl = "http://uxrepo.com/static/icon-sets/font-awesome/svg/circle-empty.svg"; aImageButton[i].Visible = true; Panel1.Controls.Add(aImageButton[i]); Panel1.Controls.Add(new LiteralControl()); } 。 我创建了一个名为ImageButtons的数组,然后使用for循环我想创建按钮,但它们没有显示在页面上。

我做错了什么?

2 个答案:

答案 0 :(得分:0)

Panel1.Controls.Add(new LiteralControl());

将其替换为:

Panel1.Controls.Add(new LiteralControl("<br /><br />"));

或删除它。

答案 1 :(得分:0)

出于安全原因,某些浏览器不会在'image'输入类型中显示svg。请查看这篇文章。 http://www.sitepoint.com/add-svg-to-web-page/