A DataGrid that integrates all kinds of functions

Source: Internet
Author: User
The RequiredFieldValidator control is used to verify whether a value is entered in an input box, and the RegularExpressionValidator control is used for regular expressions. See other information for instructions on regular expressions.
Where the ControlToValidate property is the ID number of the text box that needs to be validated. The text in the label is the prompt displayed when the checksum is unsuccessful, and the display property is the way of displaying the message.
The contents of the <Columns> tags in the DataGrid are the columns of the DataGrid, and the columns can also be added to the template column, which corresponds to each template column and can have <itemtemplate>,<edititemtemplate >,<HeaderTemplate>,<FooterTemplate> a few tags, where <ItemTemplate> is the DataGrid in the normal display when the column of the label,< Edittemplate> is also the style of the DataGrid column in the editing state.
In these tags we can insert the control and then use Datagrid1.item[i in the background code. FindControls ("Coltrol Name") can manipulate controls in the DataGrid.
To control the state of the DataGrid containing controls when Datageid is in edit state, we can use CSS style definitions to add the following code to the <style type= "Text/css" >.mytextbox {border-right: #000000 1px solid; Border-top: #000000 1px solid; font-size:9pt; Border-left: #000000 1px solid; width:80px; Border-bottom: #000000 1px solid; height:20px}
</style>
Here only a part of the code, such as the need for complete code, please write to obtain. Cheaper_c@sina.com
----------------------------------------------------------Below is the run-time screen map-----------------------------------------
------------------------------------------------part of the background code---------------------------------------------------------
Private new void DataBind ()
{
DataBind ("au_fname");
}
Overloaded DataBind () method to facilitate sorting in DataGrid
private void DataBind (string sortfield)
{
ds = new DataSet ();
da = new SqlDataAdapter ("select * from Authors_new", conn);
Da. Fill (ds, "authors");
DataView Source = ds. tables["Authors"]. DefaultView;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.