Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DATAGRID PROBLEM ???????

Status
Not open for further replies.

rohitt

Programmer
Jul 1, 2002
42
0
0
IN
HIE FRENZ..

I M USING DATAGRID N WANT TO USE BATCH UPDATE...FOR THIS I HV ADDED A
COLUMN(ITEMTEMPLATE)WHICH IS A TEXT BOX. NOW IN MY QUERY I M FETCHING DATA
BY GIVING LIKE---

"UPDATE Employees SET FirstName = '" + DataGrid1.Items.Cells[4].Text
+...SOMETHING SOMETHING....

IT DOESN'T UPDATE TABLE WITH A EMPTY STRING... ""

I ALSO CHECKED IT'S VALUE BY USING--

Response.Write(":" + DataGrid1.Items.Cells[4].Text + ":"); BUT IT STILL
PRINTS : :

BUT THAT FIELD CONTAINS TEXT..WHICH I CAN SEE..

IS THIS IS NOT THE PROPER WAY I M ACCESSING THE DATA OF AN EDITABLE TEXT BOX
FIELD IN A DATA GRID ???

IF I AM WRONG PLZ CORRECT ME ..

THANX
ROHIT
-----------------------------------
Its nice to be important, but it's more important to be nice.
 
Hi ,
I think u have to get the control that is available in the cell(textbox) and then assign the text available in the textbox. So try that ...

(A star please if it helps)..
 
Hie Ganesh,

Thanx a lot, I tried and it worked but wht i am not able to do is check if a particular value has been modified or not, coz wht i hv is a datagrid wid numerous row. So, in update i jes traverse through each text box n update the old value in database wid new value in the textbox. Even if its the same old value. So, is there any way dat it could be recognized that a value in a particular textbox in datagrid is old one or a modified new. PLZ TAKE INTO CONSIDERATION THAT SUPPOSE TEXTBOX CONTAIN VALUE --- ROHIT . I CLICKED INTO IT MADE IT ---ROHI AND THEN AGAIN MADE IT ---ROHIT . THE VALUE HAS BEEN CHANGED BUT SOME EVENTS HV BEEN GENERATED THOUGH.

Regards,
Rohit -----------------------------------
Its nice to be important, but it's more important to be nice.
 
This u can to it in the client side using javascript and update a flag(hidden field) in the datagrid and when u submit in the server side check the flag whether the value has changed and then update..

these r only pointers just give a try..
 
The other thing to do is use a dataset /w DataAdapter. The dataset has all of the functionality you are tryingto code built in already. Check out this walkthrough here.
If you are using VS then this walkthrough is included in your help files. Just look up "Creating A Distributed Application" That'l do donkey, that'l do
[bravo] Mark
If you are unsure of forum etiquette check here faq796-2540
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top