gpt4 book ai didi

c# - 按钮在 Html 表格中不可见?

转载 作者:太空宇宙 更新时间:2023-11-03 10:25:32 25 4
gpt4 key购买 nike

我正在 Azure 中维护 Azure 移动服务数据。我需要将 Azure 移动服务数据访问到网页中。所以,我的数据添加到 html 正常表中。其工作正常。但我需要设置每行编辑删除选项。我怎样才能做到这一点?。我尝试为每一行添加按钮。但按钮在表格中不可见。

WebForm.aspx

<form id="form1" runat="server" >

<table id="DBDataPlaceHolder1" class="table table-striped table-bordered" cellspacing="0" width="100%">
<thead>
<tr>
<th class="auto-style1">Code</th>
<th class="auto-style1">Name</th>
<th class="auto-style1">Descrption</th>
<th class="auto-style1">Sort</th>
<th class="auto-style1">Enable</th>
<th class="auto-style1">Action</th>

</tr>

</thead>

<asp:PlaceHolder id="PlaceHolder1" runat="server"></asp:PlaceHolder>

</table>
</form>

WebFormaspx.cs

protected void Page_Load(object sender, EventArgs e)
{

RetrieveAzureAsync(sender,e);


}

async private void RetrieveAzureAsync(object sender, EventArgs e)
{

StringBuilder htmlTable = new StringBuilder();
// This query filters out completed TodoItems and
// items without a timestamp.
IMobileServiceTable<BranchList> BranchTable = client.GetTable<BranchList>();


List<BranchList> items_list = await BranchTable
.Where(branchitem => branchitem.Enable == true)
.ToListAsync();

MyGridView1.DataSource = items_list;
MyGridView1.DataBind();

int size = items_list.Count();
if (size > 0)
{
for (int i = 0; i < size; i++)
{
htmlTable.Append("<tr>");
htmlTable.Append("<td>" + items_list[i].BranchCode + "</td>");
htmlTable.Append("<td>" + items_list[i].BranchName + "</td>");
htmlTable.Append("<td>" + items_list[i].Descr + "</td>");
htmlTable.Append("<td>" + items_list[i].Sort + "</td>");
htmlTable.Append("<td>" + items_list[i].Enable + "</td>");
htmlTable.Append("<td> <asp:Button ID='Button2' runat='server' Text='Button' OnClick='Button1_Click' /> </td>"); //this button not visble in table at run time
htmlTable.Append("</tr>");
}
htmlTable.Append("</table>");

PlaceHolder1.Controls.Add(new Literal { Text = htmlTable.ToString() });



}
}

最佳答案

<asp:Button ID='Button2' runat='server' Text='Button' OnClick='Button1_Click' />

替换为

<button id="btnSubmit" runat="server" class="myButton" 
onserverclick="Button1_Click">Edit</button>

关于c# - 按钮在 Html 表格中不可见?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31717603/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com