ASPForums.Net RSS Feedhttp://www.aspforums.net/Handlers/RSS.ashxLatest additions to the content that appears on ASPForums.Net(c) 2019 www.aspforums.com. All rights reserved.Insert Persian Date to Database using ASP.Net SqlDataSource in C#<p>Hi&nbsp;<a class="username" rel="dorsa">dorsa,</a></p> <p>Assign the&nbsp;<span style="text-decoration: underline;">OnInserting</span> event to the&nbsp;SqlDataSource and set the value to&nbsp;<span style="text-decoration: underline;">sqlDtSrcEmployees_Inserting</span>.</p> <pre class="brush: html">&lt;asp:SqlDataSource ID=&#34;sqlDtSrcEmployees&#34; runat=&#34;server&#34; ConnectionString=&#34;&lt;%$ ConnectionStrings:NorthwindConnectionString2 %&gt;&#34; InsertCommand=&#34;INSERT INTO [Employees] ([LastName], [FirstName], [HireDate]) VALUES (@LastName, @FirstName, @HireDate)&#34; SelectCommand=&#34;SELECT [EmployeeID], [LastName], [FirstName], [HireDate] FROM [Employees]&#34; OnInserting=&#34;sqlDtSrcEmployees_Inserting&#34;&gt; &lt;InsertParameters&gt; &lt;asp:ControlParameter ControlID=&#34;txtLastName&#34; Name=&#34;LastName&#34; PropertyName=&#34;Text&#34; Type=&#34;String&#34; /&gt; &lt;asp:ControlParameter ControlID=&#34;txtFirstName&#34; Name=&#34;FirstName&#34; PropertyName=&#34;Text&#34; Type=&#34;String&#34; /&gt; &lt;asp:Parameter Name=&#34;HireDate&#34; Type=&#34;DateTime&#34; /&gt; &lt;/InsertParameters&gt; &lt;/asp:SqlDataSource&gt;</pre> <p>And for&nbsp;reconverting parsian date assign the&nbsp;<span style="text-decoration: underline;">OnRowDataBound</span> event ot the GridView and set it to <span style="text-decoration: underline;">gvEmployees_RowDataBound</span>.&nbsp;</p> <pre class="brush: html">&lt;asp:GridView ID=&#34;gvEmployees&#34; CssClass=&#34;gridStyle&#34; runat=&#34;server&#34; Caption=&#34;کارمندان موجود در پایگاه داده&#34; DataSourceID=&#34;sqlDtSrcEmployees&#34; AutoGenerateColumns=&#34;False&#34; OnRowDataBound=&#34;gvEmployees_RowDataBound&#34;&gt;</pre> <p>&nbsp;</p>https://www.aspforums.net:443/Threads/156953/Insert-Persian-Date-to-Database-using-ASPNet-SqlDataSource-in-C/https://www.aspforums.net:443/Threads/156953/Insert-Persian-Date-to-Database-using-ASPNet-SqlDataSource-in-C/Mon, 10 Dec 2018 04:33:07 GMT