Click here to Skip to main content
15,914,419 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionEliminating tags in asp.net Pin
Malayil alex23-Apr-06 23:40
Malayil alex23-Apr-06 23:40 
AnswerRe: Eliminating tags in asp.net Pin
chakkara200324-Apr-06 0:01
chakkara200324-Apr-06 0:01 
Questioncreate datagrid with programming Pin
ptvce23-Apr-06 23:27
ptvce23-Apr-06 23:27 
AnswerRe: create datagrid with programming Pin
V.23-Apr-06 23:53
professionalV.23-Apr-06 23:53 
QuestionPost Back Pin
sroberts8223-Apr-06 23:07
sroberts8223-Apr-06 23:07 
AnswerRe: Post Back Pin
V.23-Apr-06 23:56
professionalV.23-Apr-06 23:56 
Questioncreate datagrid programaticaly Pin
ptvce23-Apr-06 23:03
ptvce23-Apr-06 23:03 
AnswerRe: create datagrid programaticaly Pin
chakkara200324-Apr-06 0:11
chakkara200324-Apr-06 0:11 
ICollection CreateDataSource()
{

// Create sample data for the DataGrid control.
DataTable dt = new DataTable();
DataRow dr;

// Define the columns of the table.
dt.Columns.Add(new DataColumn("IntegerValue", typeof(Int32)));
dt.Columns.Add(new DataColumn("StringValue", typeof(string)));
dt.Columns.Add(new DataColumn("CurrencyValue", typeof(double)));

// Populate the table with sample values.
for (int i = 0; i < 9; i++)
{
dr = dt.NewRow();

dr[0] = i;
dr[1] = "Item " + i.ToString();
dr[2] = 1.23 * (i + 1);

dt.Rows.Add(dr);
}

DataView dv = new DataView(dt);
return dv;

}

void Page_Load(Object sender, EventArgs e)
{

// Create a DataGrid control.
DataGrid ItemsGrid = new DataGrid();

// Set the properties of the DataGrid.
ItemsGrid.ID = "ItemsGrid";
ItemsGrid.BorderColor = System.Drawing.Color.Black;
ItemsGrid.CellPadding = 3;
ItemsGrid.AutoGenerateColumns = false;

// Set the styles for the DataGrid.
ItemsGrid.HeaderStyle.BackColor =
System.Drawing.Color.FromArgb(0x0000aaaa);

// Create the columns for the DataGrid control. The DataGrid
// columns are dynamically generated. Therefore, the columns
// must be re-created each time the page is refreshed.

// Create and add the columns to the collection.
ItemsGrid.Columns.Add(CreateBoundColumn("IntegerValue", "Item"));
ItemsGrid.Columns.Add(
CreateBoundColumn("StringValue", "Description"));
ItemsGrid.Columns.Add(
CreateBoundColumn("CurrencyValue", "Price", "{0:c}",
HorizontalAlign.Right));
ItemsGrid.Columns.Add(
CreateLinkColumn("http://www.microsoft.com", "_self",
"Microsoft", "Related link"));

// Specify the data source and bind it to the control.
ItemsGrid.DataSource = CreateDataSource();
ItemsGrid.DataBind();

// Add the DataGrid control to the Controls collection of
// the PlaceHolder control.
Place.Controls.Add(ItemsGrid);

}

BoundColumn CreateBoundColumn(String DataFieldValue,
String HeaderTextValue)
{

// This version of the CreateBoundColumn method sets only the
// DataField and HeaderText properties.

// Create a BoundColumn.
BoundColumn column = new BoundColumn();

// Set the properties of the BoundColumn.
column.DataField = DataFieldValue;
column.HeaderText = HeaderTextValue;

return column;

}

BoundColumn CreateBoundColumn(String DataFieldValue,
String HeaderTextValue, String FormatValue,
HorizontalAlign AlignValue)
{

// This version of CreateBoundColumn method sets the DataField,
// HeaderText, and DataFormatString properties. It also sets the
// HorizontalAlign property of the ItemStyle property of the column.

// Create a BoundColumn using the overloaded CreateBoundColumn method.
BoundColumn column = CreateBoundColumn(DataFieldValue, HeaderTextValue);

// Set the properties of the BoundColumn.
column.DataFormatString = FormatValue;
column.ItemStyle.HorizontalAlign = AlignValue;

return column;

}

HyperLinkColumn CreateLinkColumn(String NavUrlValue,
String TargetValue, String TextValue, String HeaderTextValue)
{

// Create a BoundColumn.
HyperLinkColumn column = new HyperLinkColumn();

// Set the properties of the ButtonColumn.
column.NavigateUrl = NavUrlValue;
column.Target = TargetValue;
column.Text = TextValue;
column.HeaderText = HeaderTextValue;

return column;

}

this is a sample code from msdn, try it


coolsweety
QuestionHow To Insert values Pin
kuwl_mark23-Apr-06 21:36
kuwl_mark23-Apr-06 21:36 
AnswerRe: How To Insert values Pin
HimaBindu Vejella23-Apr-06 23:07
HimaBindu Vejella23-Apr-06 23:07 
Questionpop3 mail Pin
sudharsong23-Apr-06 21:26
sudharsong23-Apr-06 21:26 
Questionreffering external files from web.config Pin
chakkara200323-Apr-06 21:22
chakkara200323-Apr-06 21:22 
AnswerRe: reffering external files from web.config Pin
minhpc_bk23-Apr-06 21:32
minhpc_bk23-Apr-06 21:32 
Questionasp.net sessions Pin
kh_neeru23-Apr-06 21:21
kh_neeru23-Apr-06 21:21 
AnswerRe: asp.net sessions Pin
HimaBindu Vejella23-Apr-06 21:27
HimaBindu Vejella23-Apr-06 21:27 
AnswerRe: asp.net sessions Pin
chakkara200323-Apr-06 21:28
chakkara200323-Apr-06 21:28 
GeneralRe: asp.net sessions Pin
kh_neeru23-Apr-06 21:38
kh_neeru23-Apr-06 21:38 
QuestionWhy Do we get this Error? Pin
HimaBindu Vejella23-Apr-06 21:14
HimaBindu Vejella23-Apr-06 21:14 
AnswerRe: Why Do we get this Error? Pin
minhpc_bk23-Apr-06 21:27
minhpc_bk23-Apr-06 21:27 
QuestionBind data into HTML server table control Pin
nesaraja23-Apr-06 20:39
nesaraja23-Apr-06 20:39 
AnswerRe: Bind data into HTML server table control Pin
minhpc_bk23-Apr-06 21:20
minhpc_bk23-Apr-06 21:20 
GeneralRe: Bind data into HTML server table control Pin
nesaraja23-Apr-06 21:27
nesaraja23-Apr-06 21:27 
AnswerRe: Bind data into HTML server table control Pin
HimaBindu Vejella23-Apr-06 21:28
HimaBindu Vejella23-Apr-06 21:28 
GeneralRe: Bind data into HTML server table control Pin
nesaraja23-Apr-06 22:20
nesaraja23-Apr-06 22:20 
QuestionImageButton command argument Pin
TheEagle23-Apr-06 20:38
TheEagle23-Apr-06 20:38 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.