Parse text on fly in Datagrid

Discussion in 'ASP .Net Datagrid Control' started by Brent Jenny, Oct 8, 2003.

  1. Brent Jenny

    Brent Jenny Guest

    I am a veteran asp 3.0 coder and I need some help with a datagrid
    problem. I am trying to parse some text in a datafield for display.
    In the past I would simply loop through a dataset(recordset) and have
    access to the data values at write time so that I could parse on the
    fly. Now I am using a bound DatGrid and I am not sure what to do. My
    code looks like this:

    public void CreateGrid(){
    //declare a new datagrid and set properties
    DataGrid DataGrid1 = new DataGrid();
    DataGrid1.BorderWidth = Unit.Pixel(2);
    DataGrid1.CellPadding = 10;
    DataGrid1.GridLines = GridLines.Both;
    DataGrid1.BorderColor = Color.Blue;
    DataGrid1.ShowHeader = true;
    DataGrid1.AutoGenerateColumns = false;
    DataGrid1.SelectedItemStyle.BackColor = Color.Yellow;

    //add bound columns to the datagrid
    BoundColumn datagridcol = new BoundColumn();
    datagridcol.HeaderText = "Description";
    datagridcol.DataField = "desc";
    DataGrid1.Columns.Add(datagridcol);


    datagridcol = new BoundColumn();
    datagridcol.HeaderText = "M&E P/N";
    datagridcol.DataField = "mne_number";
    DataGrid1.Columns.Add(datagridcol);


    //bind datagrid
    DataGrid1.DataSource = GetDataSet();
    DataGrid1.DataBind();

    }

    I want to limit the description field to 25 characters and insert some
    dashes into the mne_number. I know it would be best to do this in the
    stored procedure but it was written by someone else and I don't have
    access.

    signed,
    Feeling like a newby again
     
    Brent Jenny, Oct 8, 2003
    #1
    1. Advertising

  2. While bind you can call some helper function which will return you string
    with dashes, to know how have helper function while binding check out this
    "Manipulating DataSource Values while binding to DataGrid" in this article.


    http://www.microsoft.com/india/msdn/articles/SolutionstoTopFourQuestions.asp
    x

    --
    Saravana
    Microsoft MVP - ASP.NET
    www.extremeexperts.com



    "Brent Jenny" <> wrote in message
    news:...
    > I am a veteran asp 3.0 coder and I need some help with a datagrid
    > problem. I am trying to parse some text in a datafield for display.
    > In the past I would simply loop through a dataset(recordset) and have
    > access to the data values at write time so that I could parse on the
    > fly. Now I am using a bound DatGrid and I am not sure what to do. My
    > code looks like this:
    >
    > public void CreateGrid(){
    > //declare a new datagrid and set properties
    > DataGrid DataGrid1 = new DataGrid();
    > DataGrid1.BorderWidth = Unit.Pixel(2);
    > DataGrid1.CellPadding = 10;
    > DataGrid1.GridLines = GridLines.Both;
    > DataGrid1.BorderColor = Color.Blue;
    > DataGrid1.ShowHeader = true;
    > DataGrid1.AutoGenerateColumns = false;
    > DataGrid1.SelectedItemStyle.BackColor = Color.Yellow;
    >
    > //add bound columns to the datagrid
    > BoundColumn datagridcol = new BoundColumn();
    > datagridcol.HeaderText = "Description";
    > datagridcol.DataField = "desc";
    > DataGrid1.Columns.Add(datagridcol);
    >
    >
    > datagridcol = new BoundColumn();
    > datagridcol.HeaderText = "M&E P/N";
    > datagridcol.DataField = "mne_number";
    > DataGrid1.Columns.Add(datagridcol);
    >
    >
    > //bind datagrid
    > DataGrid1.DataSource = GetDataSet();
    > DataGrid1.DataBind();
    >
    > }
    >
    > I want to limit the description field to 25 characters and insert some
    > dashes into the mne_number. I know it would be best to do this in the
    > stored procedure but it was written by someone else and I don't have
    > access.
    >
    > signed,
    > Feeling like a newby again
     
    Saravana [MVP], Oct 8, 2003
    #2
    1. Advertising

  3. Brent Jenny

    Brent Jenny Guest

    "Saravana [MVP]" <> wrote in message news:<#>...
    > While bind you can call some helper function which will return you string
    > with dashes, to know how have helper function while binding check out this
    > "Manipulating DataSource Values while binding to DataGrid" in this article.
    >
    >
    > http://www.microsoft.com/india/msdn/articles/SolutionstoTopFourQuestions.asp
    > x
    >
    > --
    > Saravana
    > Microsoft MVP - ASP.NET
    > www.extremeexperts.com
    >
    >
    >
    > "Brent Jenny" <> wrote in message
    > news:...
    > > I am a veteran asp 3.0 coder and I need some help with a datagrid
    > > problem. I am trying to parse some text in a datafield for display.
    > > In the past I would simply loop through a dataset(recordset) and have
    > > access to the data values at write time so that I could parse on the
    > > fly. Now I am using a bound DatGrid and I am not sure what to do. My
    > > code looks like this:
    > >
    > > public void CreateGrid(){
    > > //declare a new datagrid and set properties
    > > DataGrid DataGrid1 = new DataGrid();
    > > DataGrid1.BorderWidth = Unit.Pixel(2);
    > > DataGrid1.CellPadding = 10;
    > > DataGrid1.GridLines = GridLines.Both;
    > > DataGrid1.BorderColor = Color.Blue;
    > > DataGrid1.ShowHeader = true;
    > > DataGrid1.AutoGenerateColumns = false;
    > > DataGrid1.SelectedItemStyle.BackColor = Color.Yellow;
    > >
    > > //add bound columns to the datagrid
    > > BoundColumn datagridcol = new BoundColumn();
    > > datagridcol.HeaderText = "Description";
    > > datagridcol.DataField = "desc";
    > > DataGrid1.Columns.Add(datagridcol);
    > >
    > >
    > > datagridcol = new BoundColumn();
    > > datagridcol.HeaderText = "M&E P/N";
    > > datagridcol.DataField = "mne_number";
    > > DataGrid1.Columns.Add(datagridcol);
    > >
    > >
    > > //bind datagrid
    > > DataGrid1.DataSource = GetDataSet();
    > > DataGrid1.DataBind();
    > >
    > > }
    > >
    > > I want to limit the description field to 25 characters and insert some
    > > dashes into the mne_number. I know it would be best to do this in the
    > > stored procedure but it was written by someone else and I don't have
    > > access.
    > >
    > > signed,
    > > Feeling like a newby again


    Saravana:

    I tried your link and I get the following message on the Microsoft India site.

    Sorry, there is no microsoft.com/india web page matching your request
     
    Brent Jenny, Oct 9, 2003
    #3
  4. check out this link
    www.microsoft.com/india/msdn/articles/SolutionstoTopFourQuestions.aspx

    --
    Saravana
    Microsoft MVP - ASP.NET
    www.extremeexperts.com



    "Brent Jenny" <> wrote in message
    news:...
    > "Saravana [MVP]" <> wrote in message

    news:<#>...
    > > While bind you can call some helper function which will return you

    string
    > > with dashes, to know how have helper function while binding check out

    this
    > > "Manipulating DataSource Values while binding to DataGrid" in this

    article.
    > >
    > >
    > >

    http://www.microsoft.com/india/msdn/articles/SolutionstoTopFourQuestions.asp
    > > x
    > >
    > > --
    > > Saravana
    > > Microsoft MVP - ASP.NET
    > > www.extremeexperts.com
    > >
    > >
    > >
    > > "Brent Jenny" <> wrote in message
    > > news:...
    > > > I am a veteran asp 3.0 coder and I need some help with a datagrid
    > > > problem. I am trying to parse some text in a datafield for display.
    > > > In the past I would simply loop through a dataset(recordset) and have
    > > > access to the data values at write time so that I could parse on the
    > > > fly. Now I am using a bound DatGrid and I am not sure what to do. My
    > > > code looks like this:
    > > >
    > > > public void CreateGrid(){
    > > > //declare a new datagrid and set properties
    > > > DataGrid DataGrid1 = new DataGrid();
    > > > DataGrid1.BorderWidth = Unit.Pixel(2);
    > > > DataGrid1.CellPadding = 10;
    > > > DataGrid1.GridLines = GridLines.Both;
    > > > DataGrid1.BorderColor = Color.Blue;
    > > > DataGrid1.ShowHeader = true;
    > > > DataGrid1.AutoGenerateColumns = false;
    > > > DataGrid1.SelectedItemStyle.BackColor = Color.Yellow;
    > > >
    > > > //add bound columns to the datagrid
    > > > BoundColumn datagridcol = new BoundColumn();
    > > > datagridcol.HeaderText = "Description";
    > > > datagridcol.DataField = "desc";
    > > > DataGrid1.Columns.Add(datagridcol);
    > > >
    > > >
    > > > datagridcol = new BoundColumn();
    > > > datagridcol.HeaderText = "M&E P/N";
    > > > datagridcol.DataField = "mne_number";
    > > > DataGrid1.Columns.Add(datagridcol);
    > > >
    > > >
    > > > //bind datagrid
    > > > DataGrid1.DataSource = GetDataSet();
    > > > DataGrid1.DataBind();
    > > >
    > > > }
    > > >
    > > > I want to limit the description field to 25 characters and insert some
    > > > dashes into the mne_number. I know it would be best to do this in the
    > > > stored procedure but it was written by someone else and I don't have
    > > > access.
    > > >
    > > > signed,
    > > > Feeling like a newby again

    >
    > Saravana:
    >
    > I tried your link and I get the following message on the Microsoft India

    site.
    >
    > Sorry, there is no microsoft.com/india web page matching your request
     
    Saravana [MVP], Oct 9, 2003
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. =?Utf-8?B?UGV0ZXI=?=

    create and stream text file on the fly

    =?Utf-8?B?UGV0ZXI=?=, Jan 20, 2005, in forum: ASP .Net
    Replies:
    3
    Views:
    5,051
    Elton Wang
    Jan 20, 2005
  2. Les Caudle
    Replies:
    5
    Views:
    386
    Hans Kesting
    Sep 18, 2006
  3. Replies:
    19
    Views:
    1,184
    Daniel Vallstrom
    Mar 15, 2005
  4. 7stud --

    optparse: parse v. parse! ??

    7stud --, Feb 20, 2008, in forum: Ruby
    Replies:
    3
    Views:
    212
    7stud --
    Feb 20, 2008
  5. Brian

    Fly outmenu on the fly

    Brian, Apr 8, 2005, in forum: Javascript
    Replies:
    0
    Views:
    127
    Brian
    Apr 8, 2005
Loading...

Share This Page