2

I have created popup window using bootstrap with some Text box.This popup window show on my html button click.I will created multiple Asp Button on page-load.I will try to each asp button click after retrieve some value into text box in popup window. i try to each asp button click after show on popup window.but,not retrieve value.so,i have one idea my asp button click after automatically click my html button.how i can do this.please help me.followed my code.
my html button

 <button id="btn2" type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Create New</button>

webform1.aspx

  <form id="form1" runat="server" class="table table-striped " cellspacing="0" width="100%">           
       <button id="btn2" type="button" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal">Create New</button>                       
  <asp:Table ID="Table1" 
            runat="server" 
            class="table table-striped table-bordered" cellspacing="0" width="100%"
            >
            <asp:TableHeaderRow runat="server"     >
                <asp:TableHeaderCell>Code</asp:TableHeaderCell>
                <asp:TableHeaderCell>Name</asp:TableHeaderCell>
                <asp:TableHeaderCell>Descrption</asp:TableHeaderCell>
                 <asp:TableHeaderCell>Sort</asp:TableHeaderCell>
                <asp:TableHeaderCell>Enable</asp:TableHeaderCell>
                 <asp:TableHeaderCell>Action</asp:TableHeaderCell>
            </asp:TableHeaderRow>
      </asp:Table>



  <!-- Modal -->
  <div class="modal fade" id="myModal" role="dialog">
    <div class="modal-dialog">

      <!-- Modal content-->
      <div class="modal-content">
        <div class="modal-header">
          <button type="button" class="close" data-dismiss="modal">&times;</button>
          <h4 class="modal-title">Add New Branch </h4>
        </div>
        <div class="modal-body">
         <%-- <p>Some text in the modal.</p>--%>





        <div class="span3">




                <div class="field">
                    <label for="firstname">Code:</label>

                    <asp:TextBox ID="txt_BranchCode" value="" placeholder="Branch Code"  runat="server" ></asp:TextBox>
                </div> <!-- /field -->

                <div class="field">
                    <label for="lastname">Name:</label> 

                    <asp:TextBox ID="txt_BranchName" value="" placeholder="Branch Name"  runat="server" ></asp:TextBox>
                </div> <!-- /field -->


                <div class="field">
                    <label for="email">Description:</label>

                    <asp:TextBox ID="txt_Descr" value="" placeholder="Description"  runat="server" Height="68px" TextMode="MultiLine"></asp:TextBox>
                </div> <!-- /field -->

                <div class="field">
                    <label for="password">Sort:</label>

                    <asp:TextBox ID="txt_Sort" value="" placeholder="Sort"  runat="server"></asp:TextBox>
                </div> <!-- /field -->

                <div class="field">
                    <label for="confirm_password">Enable:</label>


                       <asp:DropDownList ID="dd_Enable" runat="server" Width="160px">
                           <asp:ListItem>True</asp:ListItem>
                           <asp:ListItem>False</asp:ListItem>
                    </asp:DropDownList>
                </div> <!-- /field -->




            <div class="login-actions">             

                <asp:Button ID="btn_Add" class="button btn btn-primary btn-large" runat="server" Text="Add" OnClick="btn_Add_Click" />


            </div> <!-- .actions -->




        </div>  



                </div>
        <div class="modal-footer">
          <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>

        </div>
      </div>

    </div>
  </div>
  </form>

webform1.aspx.cs

        protected void Page_Load(object sender, EventArgs e)
            {



                    RetrieveAzureAsync(sender,e);

            }
            async private void RetrieveAzureAsync(object sender, EventArgs e)
            {
               IMobileServiceTable<BranchList>  BranchTable = client.GetTable<BranchList>();

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

                int size = items_list.Count();
                if (size > 0)
                {
                    for (int i = 0; i < size; i++)
                    {
                        TableRow row = new TableRow();
                        TableCell cell1 = new TableCell();
                        TableCell cell2 = new TableCell();
                        TableCell cell3 = new TableCell();
                        TableCell cell4 = new TableCell();
                        TableCell cell5 = new TableCell();
                        TableCell cell6 = new TableCell();
                        cell1.Text = items_list[i].BranchCode;
                        cell2.Text = items_list[i].BranchName;
                        cell3.Text = items_list[i].Descr;
                        cell4.Text = Convert.ToString(items_list[i].Sort);
                        cell5.Text = Convert.ToString(items_list[i].Enable);
//my multiple asp button
                        Button btn = new Button();
                        btn.Text = "Edit";
                        btn.ID = items_list[i].Id;
                        btn.Width = 70;
                        btn.CssClass = "btn btn-info btn-lg";
                        btn.Click += new EventHandler(btn_Click);




                        cell6.Controls.Add(btn);

                        row.Cells.Add(cell1);
                        row.Cells.Add(cell2);
                        row.Cells.Add(cell3);
                        row.Cells.Add(cell4);
                        row.Cells.Add(cell5);
                        row.Cells.Add(cell6);
                        Table1.Rows.Add(row);

                    }
                }
    }

     void btn_Click(object sender, EventArgs e)
            {
    //what code for click btn2 programmatically


            } 
4
  • Have you tried with runat=server? Commented Jul 31, 2015 at 10:55
  • Just put runat=server in button tag... then only you can Access it in the Server side Program(C#) Commented Jul 31, 2015 at 10:59
  • i try <asp:Button ID="btn2" class="btn btn-info btn-lg" data-toggle="modal" data-target="#myModal" runat="server" Text="Button" /> but this only show popup window Commented Jul 31, 2015 at 11:00
  • please any one help me Commented Jul 31, 2015 at 11:01

2 Answers 2

1

I have using simple way now.I have used jQuery refer this side http://jsfiddle.net/Au9tc/605/ .Thanks for replay all.

Sign up to request clarification or add additional context in comments.

Comments

0

on client side

<script>
function btnclick()
{
      $("#btn2").trigger("click");
}

</script>

on servse side

void btn_Click(object sender, EventArgs e)
            {

 Page.ClientScript.RegisterStartupScript(this.GetType(), "btnclick", "btnclick()", true);
            }

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.