2

I'm maintaining Azure Mobile service data in Azure. I will need for Access that Azure mobile service data into web page. so, My data add in html normal table.its working. but I will need set each row edit delete option. How can I do this?. I try to Each row add Button. but button not visible in table.

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() });



            }
        }
Cœur
  • 37,241
  • 25
  • 195
  • 267
Raja Priyan
  • 415
  • 2
  • 14

1 Answers1

2

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

replace with

<button id="btnSubmit" runat="server" class="myButton" 
    onserverclick="Button1_Click">Edit</button>
Saravanan Arunagiri
  • 585
  • 1
  • 5
  • 27