Programming Journal C#, Java, SQL and to a lesser extent HTML, CSS, XML, and regex. I made this so other programmers could benefit from my experience.

Thursday, June 5, 2008

Clearing controls in GridView row using delete

Here is how to clear controls in GridView row using delete. Be careful that GridViewDeleteEventArgs is not GridViewDeletedEventArgs!

<asp:GridView ID="gvStolenStatusInfo" runat="server" AutoGenerateColumns="false" AllowPaging="true"
EmptyDataText="No records found." PageSize="10" CssClass="gridView"
OnRowDeleting="gvStolenStatusInfo_RowDeleting" AutoGenerateDeleteButton="true">
<Columns>
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<asp:TextBox ID="txtuCode" runat="server" Text='<%# Bind("Code") %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Comment">
<ItemTemplate>
<asp:TextBox ID="txtuComment" runat="server" Text='<%# Bind("Comment") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
Notice the OnRowDeleting set to x_RowDeleting function and AutoGenerateDeleteButton. Now for the delete function:

protected void gvStolenStatusInfo_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
int rowID = e.RowIndex;
((TextBox)gvStolenStatusInfo.Rows[rowID].FindControl("txtuCode")).Text = string.Empty;
((TextBox)gvStolenStatusInfo.Rows[rowID].FindControl("txtuDate")).Text = string.Empty;
}
References: http://www.codeproject.com/KB/webforms/Editable_GridView.aspx

5 comments:

Anonymous said...

Hello everyone! Who knows where to upload the film Avatar?
I even bought the film Avatar for a SMS to http://rsskino.ru/kinofilm/avatar.html , the link was, but download fails, the system will boot quite strange cocoa something.
Men, advise where to normal as quickly download film avatar?

Anonymous said...

Good dispatch and this post helped me alot in my college assignement. Gratefulness you as your information.

Anonymous said...

Opulently I to but I dream the post should secure more info then it has.

Anonymous said...

I sell a boat-program which will help you to outwit auction and to win, initially the boat was created for the Scandinavian auction http://internet-aukcion.ru/ but now the program can work with similar auctions: gagen ru, vezetmne ru and with ten.
The program-boat stakes for you, i.e. for this purpose it is not necessary to sit constantly at the monitor. The boat can set time when it is necessary to stake, thus you as much as possible will lower expenses for rates, and as much as possible increase the chances of a victory.

The price of the program a boat for the Scandinavian auctions 20$

For the first 10 clients the price 15$

To all clients free updating and support.

Behind purchases I ask in icq: 588889590 Max.

Anonymous said...

[b]Set software LoveBots v 5.2[/b]

All for a mass mailing dating http://24lux.ru/

The script is written in php5

Features:

[i]registration, account activation
manual input captures, or the solution through antikapchu
filling data accounts:
- Gulf desired photo
- Инфы about yourself
- Diary
- Sexual preference[/i]

gulyalka on questionnaires spammer on lichku
- Randomization Posts: replacement of Russian letters in Latin analogues

optimized to work in a continuous loop
check-activation-filling-spam check ..

Updates and support free of charge.

Price per set 100 wmz

For the first 10 buyers price 70 wmz (your feedback on the software).

For shopping I ask in icq: 588889590 Max.

Scrin program:

[IMG]http://i066.radikal.ru/1002/9d/a7a68e8c96ee.jpg[/IMG]

[IMG]http://i054.radikal.ru/1002/19/9db76967c0e5.jpg[/IMG]

[IMG]http://s003.radikal.ru/i202/1002/24/20716e86512e.jpg[/IMG]

Flooding in the subject no! Write to feedback after the purchase.