How to use Parameterized queries in ASP.NET
The following sample is a good example of parameterized queries: How to insert data in database using Textboxes?
When I try to enter null value to DateTime field in database it is saved as 1/1/1900 12:00:00 AM
Refer When I try to enter null value for DataTime in Database I get error message ‘String was not recognized as a valid DateTime’ or ‘Value of type ’System.DBNull’ cannot be converted to ’String’’
How to use Stored Procedures in ASP.NET
Refer Store Procedure Sample
How to add a TemplateColumn dynamically to Repeater
Refer : How to add Templatecolumn dynamically to DataList? Now, instead of DataList use Repeater and make below changes VB.NET Public Sub BindLabelColumn(sender As Object, e As EventArgs) Dim lbl As Label = CType(sender, Label) Dim container As RepeaterItem = CType(lbl.NamingContainer, RepeaterItem) Dim strVals As String = Convert.ToString(DataBinder.Eval(CType(container, RepeaterItem).DataItem, ‘LastName’)) + ‘, ‘ + Convert.ToString(DataBinder.Eval(CType(container, RepeaterItem).DataItem, ‘FirstName’)) lbl.Text = strVals End Sub ’BindLabelColumn C# public void BindLabelColumn(object sender, EventArgs e) { Label lbl = (Label)sender; RepeaterItem container = (RepeaterItem)lbl.NamingContainer ; String strVals =Convert.ToString(DataBinder.Eval(((RepeaterItem)container).DataItem, ‘LastName’)) + ‘, ‘ + Convert.ToString(DataBinder.Eval(((RepeaterItem)container).DataItem, ‘FirstName’)) ; lbl.Text = strVals; }
How do I use Validator controls while editing data in the DataGrid?
Yes, you can use the Asp.Net validation controls inside a Datagrid. You’ll need to use a TemplateColumn, and on the TextBoxes (or other controls) in your EditItemTemplate, be sure to give them an ID. Then specify that ID as the ControlToValidate for the validation control. Refer How to edit data in DataGrid using TemplateColumn?