Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP .Net Datagrid Control > Parse text on fly in Datagrid

Reply
Thread Tools

Parse text on fly in Datagrid

 
 
Brent Jenny
Guest
Posts: n/a
 
      10-08-2003
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
 
Reply With Quote
 
 
 
 
Saravana [MVP]
Guest
Posts: n/a
 
      10-08-2003
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/...rQuestions.asp
x

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



"Brent Jenny" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> 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



 
Reply With Quote
 
 
 
 
Brent Jenny
Guest
Posts: n/a
 
      10-09-2003
"Saravana [MVP]" <(E-Mail Removed)> wrote in message news:<#(E-Mail Removed)>...
> 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/...rQuestions.asp
> x
>
> --
> Saravana
> Microsoft MVP - ASP.NET
> www.extremeexperts.com
>
>
>
> "Brent Jenny" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed) om...
> > 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
 
Reply With Quote
 
Saravana [MVP]
Guest
Posts: n/a
 
      10-09-2003
check out this link
http://www.microsoft.com/india/msdn/...Questions.aspx

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



"Brent Jenny" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed) om...
> "Saravana [MVP]" <(E-Mail Removed)> wrote in message

news:<#(E-Mail Removed)>...
> > 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/...rQuestions.asp
> > x
> >
> > --
> > Saravana
> > Microsoft MVP - ASP.NET
> > www.extremeexperts.com
> >
> >
> >
> > "Brent Jenny" <(E-Mail Removed)> wrote in message
> > news:(E-Mail Removed) om...
> > > 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



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
“test what you fly and fly what you test” Lawrence D'Oliveiro NZ Computing 0 06-05-2009 02:06 AM
THE FLY & THE FLY II teem DVD Video 0 12-10-2005 09:31 PM
Fly outmenu on the fly Brian Javascript 0 04-08-2005 01:34 AM
To Fly or not to fly? Should I move from Mozilla 1.5 to T-bird andF-bird? Daniel Steinberg Firefox 7 11-06-2003 11:31 AM
To Fly or not to fly? Should I move from Mozilla 1.5 to T-bird andF-bird? Daniel Steinberg Firefox 5 11-05-2003 06:23 AM



Advertisments