TextChaged in datalist(URGENT)

M

Mani

Hi,

I need help regaring below,
Please some one help.

I have a textBox in ItemTemplate column of Datalist.
I dont have Edit Command or UpDate command for Datlist.
user will enter the data in the textbox and I have to store it in the
database.
How is it possbile????

If I write it in the textChanged event, I dont know the Index or rowId in
the text changed event to update the data in the database????/

Again my question is How will I update the template column of textbox data
in the database with out the Edit Command in the Datalist??????

Any help can be appreciated.
Thanks a lot.
Mani
 
T

Teemu Keiski

Hi,

User does press some sort of Button to initiate the updating for the whole
DataList, right? In that Button's Click event, you would loop through all
items in the DataList and do the update row-by-row basis (or collect data
into single store and update in batch, whatever).

You don't have to listen for TextChanged events, however updating would be
possible in that too, because TextBox (which comes in the TextChanged's
event handler via sender argument), is in Controls collection and the
containing DataListItem is parent (or parent's parent) control of the
TextBox so basically you could dig the DataListItem via TextBox's Parent
property, look its index in DataList's DataKeyCollection (DataKeys property)
and get all the details for updating that you'd need. If the list is damn
long so that updating all at once isn't option, this would be the
alternative solution, however, updating all rows at once is quite simple
task to do.

HtH
 

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

No members online now.

Forum statistics

Threads
474,315
Messages
2,571,636
Members
48,458
Latest member
WernerAble

Latest Threads

Top