<script type="text/javascript"> $(function () { $(".myDates").datepicker(); }); </script>
<div id="myForm" runat="server"> <asp:UpdatePanel ID="UpdatePanel1" runat="server"> <ContentTemplate> <asp:Panel ID="pnlUserName" runat="server"> <fieldset class="fieldset"> <legend class="legend">Product Info</legend> <div id="textBoxGenerated" runat="server"> <asp:TextBox ID="txtseachUserName" runat="server" required="required" class="search autosuggest"></asp:TextBox> <asp:Button ID="btnsearch" runat="server" Text="Search" class="Buttom" OnClick="btnsearch_Click" /><br /> </div> </fieldset> </asp:Panel> </ContentTemplate> </asp:UpdatePanel> </div>
protected void btnsearch_Click(object sender, EventArgs e) { int number = Convert.ToInt32(txtseachUserName.Text); string top = ""; int left = 0; TextBox txt; Table tb = new Table(); tb.ID = "tb1"; TableRow tr = new TableRow(); for (int i = 1; i <= number; i++) { Label lb = new Label(); lb.ID = "lbFname" + i.ToString(); lb.Text = "Date" + i + ":"; Literal l = new Literal(); l.Text = "<br/>"; txt = new TextBox(); txt.ID = "textBox" + i.ToString();//this will add the current number to textBox means textBox1, textBox2, textBox3 etc... txt.Attributes.Add("runat", "server"); //txt.Attributes.Add("onkeyup", "SetButtonStatus(this,'btnSave')"); txt.CssClass = "myDates"; txt.Width = Unit.Pixel(240); txt.Style.Add(HtmlTextWriterStyle.MarginTop, "5px"); txt.MaxLength = 1; txt.EnableViewState = true; txt.Style.Add(HtmlTextWriterStyle.Position, "relative"); //txt.Style[HtmlTextWriterStyle.Top] = top + "px"; txt.Style[HtmlTextWriterStyle.Left] = left + "px"; left += 0; textBoxGenerated.Controls.Add(lb); textBoxGenerated.Controls.Add(txt); textBoxGenerated.Controls.Add(l); }
<script type="text/javascript"> Sys.WebForms.PageRequestManager.getInstance().add_pageLoaded(function (evt, args) { $(".DatePicker").datepicker({ dateFormat: 'dd-mm-yy' }); }); </script>
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)