Click here to Skip to main content
15,885,537 members
Home / Discussions / Web Development
   

Web Development

 
AnswerRe: ASP Export to Excel Pin
andyharman27-Feb-07 8:15
professionalandyharman27-Feb-07 8:15 
QuestionI want to Execuate EXE file on client machine through vbscript or javascript. Pin
divyesh143226-Feb-07 23:31
divyesh143226-Feb-07 23:31 
AnswerRe: I want to Execuate EXE file on client machine through vbscript or javascript. Pin
Bradml26-Feb-07 23:44
Bradml26-Feb-07 23:44 
AnswerRe: I want to Execuate EXE file on client machine through vbscript or javascript. Pin
User 171649226-Feb-07 23:54
professionalUser 171649226-Feb-07 23:54 
QuestionDatagrid fails to show data! Pin
nclauder26-Feb-07 22:04
nclauder26-Feb-07 22:04 
AnswerRe: Datagrid fails to show data! Pin
Marcus J. Smith27-Feb-07 3:11
professionalMarcus J. Smith27-Feb-07 3:11 
GeneralRe: Datagrid fails to show data! Pin
nclauder28-Feb-07 0:32
nclauder28-Feb-07 0:32 
GeneralRe: Datagrid fails to show data! Pin
Marcus J. Smith28-Feb-07 6:52
professionalMarcus J. Smith28-Feb-07 6:52 
nclauder wrote:
private void Bind()
{
dgis.DataSource = Fill();
dgis.DataBind();
}
private void InsertEmpty()
{
table.Rows.InsertAt(table.NewRow(),0);
}
private void bttnew_Click(object sender, System.EventArgs e)
{
// inserting
dgis.EditItemIndex = 0;

// modify text
EditCommandColumn ecc =(EditCommandColumn) dgis.Columns[6];
ecc.UpdateText = "Insert";

// fill table, insert empty row, bind to datagrid
Fill();
InsertEmpty();
Bind();
//dgis.DataBind();
}


You are setting the .DataSource = Fill(); but then in the Fill() you are setting the .DataSource and .DataBind. You are also inserting the row after the initial bind so you are sort of repeating steps unnecessarily.

Try this.

DataTable table = new DataTable();

private DataTable Fill(){ 
SqlDataAdapter adapter = new SqlDataAdapter("SELECT * from dbo.DashBoard", con);
adapter.Fill(table);
return table;
} 

private void Bind(){ 
dgis.DataSource = Fill();
dgis.DataBind();
}

private void InsertEmpty(){ 
table.Rows.InsertAt(table.NewRow(),0); 
}

private void bttnew_Click(object sender, System.EventArgs e){
// inserting
dgis.EditItemIndex = 0;

// modify text
EditCommandColumn ecc =(EditCommandColumn) dgis.Columns[6];
ecc.UpdateText = "Insert"; 

// fill table, insert empty row, bind to datagrid 
Fill();
InsertEmpty();
Bind();
}
Why are you inserting an empty row when you begin editing? You should be able to just read in that row on the datagrid and add it to the datatable after the editing is finished. Check out http://www.datagridgirl.com[^].


CleaKO

"I think you'll be okay here, they have a thin candy shell. 'Surprised you didn't know that." - Tommy Boy
"Fill it up again! Fill it up again! Once it hits your lips, it's so good!" - Frank the Tank (Old School)

GeneralRe: Datagrid fails to show data! Pin
nclauder28-Feb-07 20:17
nclauder28-Feb-07 20:17 
Questionapache server Pin
Manjunath S26-Feb-07 21:51
Manjunath S26-Feb-07 21:51 
AnswerRe: apache server Pin
Bradml26-Feb-07 23:44
Bradml26-Feb-07 23:44 
Questionnew error Pin
No-e26-Feb-07 9:17
No-e26-Feb-07 9:17 
AnswerRe: new error Pin
kubben26-Feb-07 9:27
kubben26-Feb-07 9:27 
GeneralRe: new error Pin
No-e26-Feb-07 9:47
No-e26-Feb-07 9:47 
QuestionHow to handle secondary tables that key off primary table Pin
MaxRelaxman26-Feb-07 7:23
MaxRelaxman26-Feb-07 7:23 
QuestionSpecified Cast Not Valid Pin
No-e26-Feb-07 7:12
No-e26-Feb-07 7:12 
AnswerRe: Specified Cast Not Valid Pin
kubben26-Feb-07 7:36
kubben26-Feb-07 7:36 
GeneralRe: Specified Cast Not Valid Pin
No-e26-Feb-07 9:01
No-e26-Feb-07 9:01 
GeneralRe: Specified Cast Not Valid Pin
kubben26-Feb-07 9:02
kubben26-Feb-07 9:02 
AnswerRe: Specified Cast Not Valid Pin
Guffa26-Feb-07 23:45
Guffa26-Feb-07 23:45 
Questionadding a row on a datagrid Pin
nclauder26-Feb-07 1:02
nclauder26-Feb-07 1:02 
QuestionSharepoint 2007 code to get a list of User Profiles. Pin
Member 368588925-Feb-07 23:41
Member 368588925-Feb-07 23:41 
QuestionASP 3.0 Search In Word Document using classic asp 3.0 Pin
adnanrafiq25-Feb-07 12:33
adnanrafiq25-Feb-07 12:33 
QuestionAuto-incrementing assembly build numbers for ASP.NET 2.0 Pin
MayyMagdy25-Feb-07 10:46
MayyMagdy25-Feb-07 10:46 
AnswerRe: Auto-incrementing assembly build numbers for ASP.NET 2.0 Pin
kubben26-Feb-07 7:41
kubben26-Feb-07 7:41 

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.