Help :-) Beginner in ASP.NET ... Help in Datagrid

Hi , 

I'm a novice to the ASP.NET/ADO.Net field. I have a datagrid web control in which i show data that is read from a table(assume table has just one field called I_status ). Every row in the datagrid has a button control column called "Update" (created using <asp:ButtonControl ButtonType="PushButton" > ). My case is that upon clicking the Update button in any row, i need to set the column entry for I_Status field (for that particular row in which Update button was clicked) to value 0. I am writing the following code for the gridEvent Handler
Sub grdSiteMessage_UpdateButton(ByVal sender As Object, ByVal e As DataGridCommandEventArgs)
Dim I_StatusCell As TableCell = e.Item.Cells(0)
Dim intI_StatusCell As String = I_StatusCell.Text

Catch ex As Exception
Throw ex
End Try
End Sub
The value of the field I_Status (cell(0)) is displayed properly on the grid, but I would highly appreciate if anyone can tell me how I can edit that value to set it to 0.
thanks n' hugs :)..
9/7/2004 8:03:40 PM 72751 articles. 3 followers. Follow

2 Replies

Similar Articles

[PageSpeed] 5

Hi there Liz!

So you want to take all out of a DataGrid, that's cool! ;)
There are some cool features with the DataGrid for editing, updating and cancelling the edit state, so here we go:
Ok, first thing to do is to create the update, edit and cancel buttons like this (not using that <asp:ButtonControl>):

<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>

That's easy. Now we can add the appropriate Event handlers for CancelCommand, EditCommand and UpdateCommand like this:

<asp:DataGrid.... OnCancelCommand="OnCancel" OnEditCommand="OnEdit" OnUpdateCommand="OnUpdate" ...>

I assume, this you are familiar with adding event handlers, so I won't be telling any stories about them. Now Let's create those three event handlers. There is a property called EditItemIndex in the DataGrid which tells which row to edit.
There is also a method for updating teh datagrid where you have to do the DataBind from the datasource of yours. This is done because otherwise teh changes we made don't show in the datagrid. The UpdateDataGrid method is usually done in the first Page_Load and then after any changes to the datagrid.

//This is the page loading method, where we initialize the datagrid for the first time:
protected void Page_Load(object source, EventArgs e)
//We initialize the datagrid only in the first occurrence of this page:
private void UpdateDataGrid()
//Here you do your data binding from the database or other data source to the datagrid.
//This is for cancelling edit.
protected void OnCancel(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
//Because we cancel editing, just put the EditItemIndex to -1:
(source as DataGrid).EditItemIndex = -1;
//This is for starting editing.
protected void OnEdit(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
//Set the Edit ItemIndex to the row, we want to edit and update datagrid:
(source as DataGrid).EditItemIndex = e.Item.ItemIndex;
//This is for updating the edited row f.ex. into the db.
protected void OnUpdate(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
//Here you can do whatever you need to do. You might update the values of the row to a database or something..
//Set the EditItemIndex to -1 to stop the editing:
(source as DataGrid).EditItemIndex = -1;

I hope this helped you at least somehow. Please feel free to ask more, if you dindn't catch something!
Good Luck!
Arto Kainu


Joensuu, Finland
9/8/2004 7:00:17 AM
Hi Loor..thanxx a ton to helped me a lot..!... i appreciate ur help a lot
9/9/2004 7:17:26 PM

Similar Artilces:

Help Help Help Help Help Help
------=_NextPart_000_0074_01C2960E.EBE13A30 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Can someone please help me. I have installed mysql on Unix Solaris and it works fine I have Perl installed previously which is working and with which i have installed other perlmodules before and are working fine. I have also installed DBI and it works fine with the Sybase drivers which i have installed. When i tried to install the Msql-Mysql-modules-1.2219 drivers i get the following error. # make /usr/local/bin/perl -Iblib/arch -Iblib/lib -I/...

I was using powerbuilder4.0 a month ago I decided that migrate it to PB7.0 When Im using 4.0, in datawindows I was using extra colums additional to stores procedure. I mean that for example; stored proc. returns 4 columns. I was using 2 extra columns to modify something from client. But I cant do the same thing in PB7.0. How can I do that??? please help. Gurcan yucel "I was using 2 extra columns to modify something from client." what does this mean that you added to the result set? If so then just goto the SQL and add a param. Then set the...

Help Help Help Help
i need to create a crosstab report using Crystal reprot for VS 2003 i face aproblem when i need to order my Fileds by their names my data must be like this Basic Cola Housing Gross Deduction1 Deduction2 Deduction3 Net but when i run my report it give my a not sorted data acutally i have acode field which can i order field using it. but i don't knwo how to do thisSo..................? Select Report tab | |-->Select Record Sort expert Choost the fields you want to sort --Select the corresponding sort direction f...

help help help help
Name: chef mario Email: Product: Firefox Summary: help help help help Comments: Heard great reports about Firefox!!! Downloaded & installed Firefox !!!! Lost All my very very valuable BOOKMARKS!!! CAN ANYONE HELP!!!!! All bookmarks were in Internet Explorer Did bookmark transfer to Firefox. Seem the Fox eat all m,y bookmarks Need serious help anyone. chef mario Browser Details: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US; rv:1.8) Gecko/20051025 Firefox/1.5 ...

Help Help Help DataWindow.NET 2.0
Hello, i am using datawindow.NET 2.0 evaluation version my application is working fine using Pbls as source for objects as soon as i change the Pbl to PBD the application gives the error object not found however help says that u can use PBDs kindly tell me that this error is due to evaluation version or there is something wrong i am very worried about this behaviour because i have to report to my project manager for this behaviour of datawindow.NET kindly reply thanks Haroon Yes PBDs will work with the evaluation version. Is this a web forms or Windows Form...

i need help, i use an dbmaker 3.0 server and now i want to use an client to go on it but i dont have an client(i have dbmaker 3.6 but it don't work) who can help me with the dbmaker 3.0 client (tools,files,drivers) email me ...

Whether can I set a window to be unmoveable when the application is run,whatever the window is normal or max when it's running?If it may be set,how.... ...

help help help
after i unload., theni install adaptaive server.......everythings running well but unluckily it cannot start the adaptive server when installing but backupserver and XP server can install and start it Building Adaptive Server "abc", unable to boot server "abc" server "abc" was not connected anyone can help me Was an errorlog created for this ASE in the ASE install directory? If so, what does it say? Zidane wrote: > after i unload., theni install adaptaive server.......everythings running > well > but unluckily it cannot st...

Sorry to re-post again, Hi, Dean : 1. Are you dialing an ISP or dialing modem pool in side the company? I am dailing an ISP. Because some of my client use this way. 2. Is the Jag server behind a firewall? No, there is no Firwall. 3. Do you have a proxy for the remote component? Yes. 4. What is the syntax of createinstance? ls_class = "p_packagename/n_cst_logon" if not isvalid(inv_logon) then ll_return = g_connect.CreateInstance(inv_logon,ls_class) if ll_return <> 0 then ls_return = ...

I need EAS 3.0.1 mantainance as soon as possible or at least an updated datawindow.jar. I've already asked the mantainance CD to italian Sybase support but they know nothing about it. If someone from sybase could send me an updated datawindow.jar would be very very appreciated. Please email me to Thank you Mauro Mazza Research & Develop - Gruppo FINMATICA E-mail: ADS automated data systems - Data Processing S.p.A. Via Del Lavoro, 17 40127 Bologna - Italy tel. +39 051 6307 411 fax. +39 051 6307 498 We expect t...

help help help
i wanna know the list of compite time errors related to code correction/programming errors in powerbuilder.thanks lot cenk That's a pretty big request. You want a list of everything it is possible to do wrong in PowerBuilder? What you might want to do is search the solved cases infobase on the Sybase web site. On Tue, 15 Jun 1999 11:50:32 +0300, in powersoft.public.powerbuilder.general cenk KIZILDAG <> wrote: >i wanna know the list of compite time errors related to code >correction/programming errors in powerbuilder.thanks lot > >c...

can't Install dbd for postgreSQL someboy can help, Me How about some code. Do you have the DBD::pg installed? Send in you code so we can help. Ilya Sterin -----Original Message----- From: [] Sent: Monday, April 02, 2001 4:45 PM To: Subject: HELP, HELP, HELP!!!! can't Install dbd for postgreSQL someboy can help, Me ...

What am I doing WRONG #!/usr/bin/perl -w # # Consilta.cgi # push(@INC,"/var/www/cgi-bin/"); require(""); $|=1; #use strict; use DBI; use CGI; sub avisa_y_salte { my $error = "@_"; print &PrintHeader; print "<h1>Error Inesperado</h1>"; print "<p>$error</p>"; print &HtmlBot; die $DBI::errstr; } my $version="V.20.01"; my $registro="<CENTER><H5><I>Consulta Ciudadana $version 2001. <A HREF=\"mailto:a...

Hi again: Just tested my first test and proceeded to test and install a second time. This time I let the server run the update after registering with Novell. However, upon reboot the server was dorked as it could not read my /usr and /var partitions (fstab was bad). Now here is what changed between my first the second build: I added a separate partition for /usr, that is all. I could really use a hand here. If I can't trust the update mechanism ...... Chris. Chris wrote: > Hi again: Just tested my first test and proceeded to test > and install a second...

I try set picture to database and import it to picture control. Why SetPicture funktio dosen�t work? blob b, tot_b integer li_FileNum, loops, i, ret long flen, bytes_read, new_pos string txtname, named string defext = "BMP", Filter = "bitmap Files (*.bmp), *.bmp" ret = GetFileOpenName("Open Bitmap", txtname, named, defext, filter) SetPointer(HourGlass!) flen = FileLength(txtname) li_FileNum = FileOpen(txtname, StreamMode!, Read!, LockRead!) IF flen > 32765 THEN IF Mod(flen, 32765) = 0 THEN loops = flen/32765 ELSE loops = (flen/32765...

Web resources about - Help :-) Beginner in ASP.NET ... Help in Datagrid -

Zen Mind, Beginner's Mind - Wikipedia, the free encyclopedia
Zen Mind, Beginner's Mind is a book of teachings by the late Shunryu Suzuki , a compilation of talks given to his satellite Zen center in Los ...

Bitcoin Beginners (@BTCBeginners) on Twitter
Log in Sign up You are on Twitter Mobile because you are using an old version of Internet Explorer. Learn more here Bitcoin Beginners @ BTCBeginners ...

German Vocabulary Free - Flashcards for Beginners & Kids on the App Store on iTunes
Get German Vocabulary Free - Flashcards for Beginners & Kids on the App Store. See screenshots and ratings, and read customer reviews.

Beginner's Bible Coloring Book! - Flickr - Photo Sharing!
Dad, did dinosaurs really exist? Sure they did, son. The Bible says so. They didn't call them &quot;dinosaurs&quot; back then, but instead they ...

Hatha Yoga For Beginners, A guide with 10 poses, details and benefits explained - YouTube
A video of beginners version of Hatha Yoga Sequence. 1. Let's start with easy Leg Raises: One leg is raised while the other remains flat on the ...

Second Test: Beginners' luck or Burns and Khawaja's time?
If Burns and Khawaja can bat positively with intent in the second Test like they did at the Gabba, we will see them in the side for years to ...

A Rugby World Cup beginners' guide: when to wake up and who to look out for
A guide on when to get up, who to look out for and what makes Sunday morning's showdown so special.

The Beginner’s Guide review: Failure is as failure does
... for entirely different reasons. Frankly, you won't find many video games who posit their creators as a lead character in the way that The Beginner's ...

COP21: Beginner's guide to the UN Paris climate summit
A background guide to the UN's major conference on climate change taking place in Paris until December 11.

Ben Kingsley & Josh Hutcherson Book ‘Backstabbing For Beginners’ – AFM
From Danish helmer Per Fly, Backstabbing For Beginners is a political thriller inspired by international relations veteran Michael Soussan’s ...

Resources last updated: 12/8/2015 8:29:43 PM