Click here to Skip to main content
15,897,891 members
Articles / Web Development / ASP.NET

Selectable GridView with WaitBox

Rate me:
Please Sign up or sign in to vote.
3.89/5 (9 votes)
16 Oct 2008CPOL2 min read 31.3K   652   45  
This article describes how to implement a selectable GridView control in ASP.NET.
<?xml version="1.0" encoding="utf-8"?>
<xs:schema id="NewsItems" targetNamespace="http://tempuri.org/NewsItems.xsd" xmlns:mstns="http://tempuri.org/NewsItems.xsd" xmlns="http://tempuri.org/NewsItems.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:msprop="urn:schemas-microsoft-com:xml-msprop" attributeFormDefault="qualified" elementFormDefault="qualified">
  <xs:annotation>
    <xs:appinfo source="urn:schemas-microsoft-com:xml-msdatasource">
      <DataSource DefaultConnectionIndex="0" FunctionsComponentName="QueriesTableAdapter" Modifier="AutoLayout, AnsiClass, Class, Public" SchemaSerializationMode="IncludeSchema" xmlns="urn:schemas-microsoft-com:xml-msdatasource">
        <Connections>
          <Connection AppSettingsObjectName="Web.config" AppSettingsPropertyName="ReorderListDBConnectionString" IsAppSettingsProperty="True" Modifier="Assembly" Name="ReorderListDBConnectionString (Web.config)" ParameterPrefix="@" PropertyReference="AppConfig.System.Configuration.ConfigurationManager.0.ConnectionStrings.ReorderListDBConnectionString.ConnectionString" Provider="System.Data.SqlClient">
          </Connection>
        </Connections>
        <Tables>
          <TableAdapter BaseClass="System.ComponentModel.Component" DataAccessorModifier="AutoLayout, AnsiClass, Class, Public" DataAccessorName="NewsItemsTableAdapter" GeneratorDataComponentClassName="NewsItemsTableAdapter" Name="NewsItems" UserDataComponentName="NewsItemsTableAdapter">
            <MainSource>
              <DbSource ConnectionRef="ReorderListDBConnectionString (Web.config)" DbObjectName="dbo.NewsItems" DbObjectType="Table" GenerateMethods="Get" GenerateShortCommands="True" GeneratorGetMethodName="GetData" GetMethodModifier="Public" GetMethodName="GetData" QueryType="Rowset" ScalarCallRetval="System.Object, mscorlib, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" UseOptimisticConcurrency="False" UserGetMethodName="GetData" UserSourceName="GetData">
                <DeleteCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="False">
                    <CommandText>DELETE FROM [NewsItems] WHERE (([ItemID] = @Original_ItemID))</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Original_ItemID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="ItemID" SourceColumnNullMapping="False" SourceVersion="Original">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </DeleteCommand>
                <InsertCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="False">
                    <CommandText>INSERT INTO [NewsItems] ([Title], [Description], [Priority]) VALUES (@Title, @Description, @Priority)</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Title" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Title" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="True" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Description" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Description" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@Priority" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="Priority" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
                    </Parameters>
                  </DbCommand>
                </InsertCommand>
                <SelectCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="True">
                    <CommandText>SELECT * FROM NewsItems ORDER BY Priority</CommandText>
                    <Parameters>
                    </Parameters>
                  </DbCommand>
                </SelectCommand>
                <UpdateCommand>
                  <DbCommand CommandType="Text" ModifiedByUser="False">
                    <CommandText>UPDATE [NewsItems] SET [Title] = @Title, [Category] = @Category WHERE (([ItemID] = @original_ItemID))</CommandText>
                    <Parameters>
                      <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Title" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Title" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>                     
						<Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="Int32" Direction="Input" ParameterName="@original_ItemID" Precision="0" ProviderType="Int" Scale="0" Size="0" SourceColumn="ItemID" SourceColumnNullMapping="False" SourceVersion="Original">
                      </Parameter>
					 <Parameter AllowDbNull="False" AutogeneratedName="" DataSourceName="" DbType="String" Direction="Input" ParameterName="@Category" Precision="0" ProviderType="NVarChar" Scale="0" Size="0" SourceColumn="Category" SourceColumnNullMapping="False" SourceVersion="Current">
                      </Parameter>
					  </Parameters>
					  </DbCommand>
                </UpdateCommand>
              </DbSource>
            </MainSource>
            <Mappings>
              <Mapping SourceColumn="ItemID" DataSetColumn="ItemID" />
              <Mapping SourceColumn="Title" DataSetColumn="Title" />
              <Mapping SourceColumn="Description" DataSetColumn="Category" />
              <Mapping SourceColumn="Priority" DataSetColumn="Date" />
            </Mappings>
            <Sources>
            </Sources>
          </TableAdapter>
        </Tables>
        <Sources>
        </Sources>
      </DataSource>
    </xs:appinfo>
  </xs:annotation>
  <xs:element name="NewsItems" msdata:IsDataSet="true" msdata:UseCurrentLocale="true" msprop:Generator_UserDSName="NewsItems" msprop:Generator_DataSetName="NewsItems">
    <xs:complexType>
      <xs:choice minOccurs="0" maxOccurs="unbounded">
        <xs:element name="NewsItems" msprop:Generator_UserTableName="NewsItems" msprop:Generator_RowDeletedName="NewsItemsRowDeleted" msprop:Generator_RowChangedName="NewsItemsRowChanged" msprop:Generator_RowClassName="NewsItemsRow" msprop:Generator_RowChangingName="NewsItemsRowChanging" msprop:Generator_RowEvArgName="NewsItemsRowChangeEvent" msprop:Generator_RowEvHandlerName="NewsItemsRowChangeEventHandler" msprop:Generator_TableClassName="NewsItemsDataTable" msprop:Generator_TableVarName="tableNewsItems" msprop:Generator_RowDeletingName="NewsItemsRowDeleting" msprop:Generator_TablePropName="_NewsItems">
          <xs:complexType>
            <xs:sequence>
              <xs:element name="ItemID" msdata:ReadOnly="true" msdata:AutoIncrement="true" msprop:Generator_UserColumnName="ItemID" msprop:Generator_ColumnVarNameInTable="columnItemID" msprop:Generator_ColumnPropNameInRow="ItemID" msprop:Generator_ColumnPropNameInTable="ItemIDColumn" type="xs:int" />
              <xs:element name="Title" msprop:Generator_UserColumnName="Title" msprop:Generator_ColumnVarNameInTable="columnTitle" msprop:Generator_ColumnPropNameInRow="Title" msprop:Generator_ColumnPropNameInTable="TitleColumn">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="50" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Category" msprop:Generator_UserColumnName="Category" msprop:Generator_ColumnVarNameInTable="columnCategory" msprop:Generator_ColumnPropNameInRow="Category" msprop:Generator_ColumnPropNameInTable="CategoryColumn" minOccurs="0">
                <xs:simpleType>
                  <xs:restriction base="xs:string">
                    <xs:maxLength value="256" />
                  </xs:restriction>
                </xs:simpleType>
              </xs:element>
              <xs:element name="Date" msprop:Generator_UserColumnName="Date" msprop:Generator_ColumnVarNameInTable="columnDate" msprop:Generator_ColumnPropNameInRow="Date" msprop:Generator_ColumnPropNameInTable="DateColumn" type="xs:string" />
            </xs:sequence>
          </xs:complexType>
        </xs:element>
      </xs:choice>
    </xs:complexType>
    <xs:unique name="Constraint1" msdata:PrimaryKey="true">
      <xs:selector xpath=".//mstns:NewsItems" />
      <xs:field xpath="mstns:ItemID" />
    </xs:unique>
  </xs:element>
</xs:schema>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Junior) Artaker Computersysteme GmbH
Austria Austria
I've began programming at the Warsaw University of Technolog. Currently I'm trying hardly;) to finish a master program at Vienna University of Technology and at the same time I'm working as Software Developer.
I'm interested in Web Development, technologies like AJAX, Silverlight, Semantic Web etc.

Comments and Discussions