473,549 Members | 2,731 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Customer Action in GridView

3 New Member
I am having an issue creating a column in a GridView control using c#. when the user clicks the delete link i want the logic to delete the database record and also an associated file. thusly i created a page that using a paramater passed in the url would display a confirmation message then delete the file. I am simply trying to insert a TemplateField containing a link to my delete confirm page. the problem is that im not sure how to insert the needed information into the link i.e.(the file id from the DataKeyNames array) Here is the code i am using for my GridView

<asp:GridView ID="gvTempFiles " runat="server" AllowPaging="Tr ue" AllowSorting="T rue"
AutoGenerateCol umns="False" DataKeyNames="F ileID" DataSourceID="T empFileDataSour ce"
>
<Columns>
<asp:BoundFie ld DataField="File Name" HeaderText="Fil eName" SortExpression= "FileName" />
<asp:BoundFie ld DataField="File Desc" HeaderText="Fil eDesc" SortExpression= "FileDesc" />
<asp:BoundFie ld DataField="File Type" HeaderText="Fil eType" SortExpression= "FileType" />
<asp:TemplateFi eld>
<ItemTemplate >
<a href="PicDetail .aspx?id="" >Delete</a>
</ItemTemplate>
</asp:TemplateFie ld>
</Columns>
</asp:GridView>

Thanks for any help you can give
Mar 21 '07 #1
2 1735
sani723
117 New Member
use the DeleteCommand event to do this, and also use the alert("") for confirmation instead of transferring to another page.
Mar 22 '07 #2
TeamN2
3 New Member
Is there a simple way to get back the selected datakey when using the rowdelted or rowdeleting event. so far whenever i have tried to use either of these event the selecteddatakey is always set to null
Mar 29 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

3
5657
by: Mark Harris | last post by:
I have an installer which uses a Customer Information page in it, is there an easy way to pass the serial number entered to a custom action? If not, where would i find the serial number in the registry? I'm using C# for the custom action -- Mark Harris
6
3024
by: Nalaka | last post by:
Hi, I have a gridView (grid1), which as a templateColumn. In the template column, I have put in a gridView (grid2) and a ObjectDataSource (objectDataSource2). Question is... How to I pass the current_row_key of Grid1... to the objectDataSource2 parameter? (so that the second grid, gets only the information to do with current row of grid1)
5
4825
by: Dick | last post by:
I have a GridView bound to an ObjectDataSource. I have a Button that calls GridView.DataBind. I want the row that is selected before the DataBind to still be selected afterwards. This happens automatically if the data doesn't change. But if records have been added or deleted then it looks as if some code is necessary: I've done this by...
6
3511
by: RobR | last post by:
We have a customer using our application that has a problem. Within our app, we have a two different forms (one generates an email, the other a fax via a webservice). When they click the submit button, IE6 is generating the event 6 times!!! So they end up sending 6 faxes or 6 emails. We simply cannot reproduce this. We can't find anything...
3
4469
by: Rabbit | last post by:
Hi, I'm having a GridView with Datasource being set from CodeBehind method, its has a "RecID" databound field set as invisible. I want to utilize the "Delete" commandfield, so that on gridview_RowDeleting event, i can perform a customised delete action. I've tried me.gridview.Rows(e.RowIndex).Cells(intField).Text, which only works for...
10
2404
by: Benton | last post by:
Hi there, I have a UserControl with a couple of textboxes and a couple of buttons ("Save" and "Cancel"). The Click event for this buttons is in the UserControl's codebehind of course, so here's my question. Once the UserControl is dropped onto the container page, how can I perform some action on the codebehind of the container page from...
4
1735
by: Davey | last post by:
Hi All, I am learning .NET. I am a little confusing about when do I need a customer installer. I can add the Installer class in my WinForm project. But I don't know what the purpose of that. Under what circumtance do I need a customer installer? Thanks,
2
2216
by: Gunawan | last post by:
Hi, I would like to execute a function when user click on a commandfield (deletecommandfield) from a gridview. How can I do that? I can not find how to put code in it. Thank you In Advance Gun
1
2664
by: ramprakashjava | last post by:
hi , i hav this error while running this customerDetails.jsp <html:html> <head> <html:base/> </head> <body> <html:errors/> <html:form action="/submitCustomerForm"> <bean:message key="prompt.customer.firstname"/>
0
7518
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7446
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7715
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
1
5368
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5087
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3498
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3480
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1935
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
1
1057
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.