Parse text on fly in Datagrid

B

Brent Jenny

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
 
B

Brent Jenny

Saravana said:
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:

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
 

Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top