Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > DataBind

Reply
Thread Tools

DataBind

 
 
Calvin Lai
Guest
Posts: n/a
 
      01-21-2004
Hi all,

Say I have a DataTable object (oDT) resting on the ViewState object. And I
have a button called AddButton and a DataGrid, which its datasource is the
oDT.

If I want my app behaves so that whenever the user clicked the AddButton,
internally (server side) will add a row into the oDT and the DataGrid will
reflect such changes, AND, with that newly added row as editable.

I have tried many different ways but still no hope. Below is my code
snipplet.

AddButton_Click()
{
oDT.Rows.Add(oDT.NewRow());
oDG.Datasource = oDT;
oDG.DataBind();
oDG.EditeItemIndex = oDT.Rows.Count;
....
}

and it doesn't work...please help.

Calvin


 
Reply With Quote
 
 
 
 
Alvin Bruney
Guest
Posts: n/a
 
      01-24-2004
I'm providing a link to attach a row to a datagrid. Then you would need to
set the edit item index to the row depending on where you add it, the index
may vary
http://tinyurl.com/ytvrg
--
Regards,
Alvin Bruney [ASP.NET MVP]
Got tidbits? Get it here...
http://tinyurl.com/3he3b
"Calvin Lai" <clai[at]qdata[dot]com> wrote in message
news:uiJjo%(E-Mail Removed)...
> Hi all,
>
> Say I have a DataTable object (oDT) resting on the ViewState object. And I
> have a button called AddButton and a DataGrid, which its datasource is the
> oDT.
>
> If I want my app behaves so that whenever the user clicked the AddButton,
> internally (server side) will add a row into the oDT and the DataGrid will
> reflect such changes, AND, with that newly added row as editable.
>
> I have tried many different ways but still no hope. Below is my code
> snipplet.
>
> AddButton_Click()
> {
> oDT.Rows.Add(oDT.NewRow());
> oDG.Datasource = oDT;
> oDG.DataBind();
> oDG.EditeItemIndex = oDT.Rows.Count;
> ...
> }
>
> and it doesn't work...please help.
>
> Calvin
>
>



 
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
BUG in DataBind? After .DataBind there are more DataGrid Items than DataSet Rows! Michael ASP .Net Datagrid Control 0 12-29-2003 07:47 PM
Dropdownlist adding data after databind Kimberly Walker ASP .Net 0 10-23-2003 02:09 AM
Databind Jay ASP .Net 3 07-28-2003 09:57 PM
Datagrid doesn't refresh after databind - (Damn It) Admin ASP .Net 0 07-08-2003 03:35 AM
Me.databind() stops button handlers? Ante Perkovic ASP .Net 0 06-30-2003 07:46 AM



Advertisments