asp.net Dynamic Data Site with own MetaData

Posted by loviji on Stack Overflow See other posts from Stack Overflow or by loviji
Published on 2010-04-20T18:21:53Z Indexed on 2010/04/20 20:53 UTC
Read the original article Hit count: 509

Filed under:
|
|

Hello, I'm searching info about configuring own MetaData in asp.NET Dynamic Site.

For example. I have a table in MS Sql Server with structure shown below:

CREATE TABLE [dbo].[someTable](
    [id] [int] NOT NULL,
    [pname] [nvarchar](20) NULL,
    [FullName] [nvarchar](50) NULL,
    [age] [int] NULL)

and I there are 2 Ms Sql tables (I've created), sysTables and sysColumns.

sysTables:

ID sysTableName TableName TableDescription

1 | someTable |Persons |All Data about Persons in system

sysColumns:

ID TableName sysColumnName ColumnName ColumnDesc ColumnType MUnit

1 |someTable | sometable_pname| Name | Persona Name(ex. John)| nvarchar(20) | null
2 |someTable | sometable_Fullname| Full Name | Persona Name(ex. John Black)| nvarchar(50) | null
3 |someTable | sometable_age| age | Person age| int | null

I want that, in Details/Edit/Insert/List/ListDetails pages use as MetaData sysColumns and sysTableData. Because, for ex. in DetailsPage fullName, it is not beatiful as Full Name .

someIdea, is it possible?

thanks

Updated:: In List Page to display data from sysTables (metaData table) I've modified <h2 class="DDSubHeader"><%= tableName%></h2>.

public string tableName;
protected void Page_Init(object sender, EventArgs e)
{

            table = DynamicDataRouteHandler.GetRequestMetaTable(Context);
            //added by me
            uqsikDataContext sd=new uqsikDataContext();
            tableName = sd.sysTables.Where(n => n.sysTableName == table.DisplayName).FirstOrDefault().TableName;
            //end

            GridView1.SetMetaTable(table, table.GetColumnValuesFromRoute(Context));
            GridDataSource.EntityTypeName = table.EntityType.AssemblyQualifiedName;
            if (table.EntityType != table.RootEntityType)
            {
                GridQueryExtender.Expressions.Add(new OfTypeExpression(table.EntityType));
            }
 }

so, what about sysColums? How can I get Data from my sysColumns table?

© Stack Overflow or respective owner

Related posts about dynamic-data

Related posts about ASP.NET