473,394 Members | 1,714 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

pass variable in data grid view

Hi;
I am having trouble to get variable from grid view. here is my
scenario. I want to delete a row in database from web page, in additon,
I also want to delete that user's directory in c:drive. so far, I can
only finished the first part which is to delete the row from database,
Please see below code where I want to get variable in order to delete
the directory. Thanks in advance
<%@ Page Language="VB" Debug="true" %>

<script language="VB" runat="server" >
Sub Page_Load(ByVal Source As Object, ByVal E As EventArgs)

If Page.IsPostBack Then
'Delete Main Directory
'Directory.Delete("c:\djohn")---->I want to pass the below
asp:HyperLinkField DataTextField="UserName" as a variable to replace
djohn in here!!!
End If
End Sub
</script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>eMint Admin</title>
<script language=javascript>
function ConfirmDelete(){
return confirm('Are you sure want to delete this user
account?');
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:Label ID="Label1" runat="server" Font-Names="Arial"
Font-Size="Larger" ForeColor="Blue"
Text="eMints Account Admin"></asp:Label><br />
<br />
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [RecordID], [LastName], [FirstName],
[Location], [Phone], [Status], [UserName] FROM [eMints] ORDER BY
[LastName]"
DeleteCommand="DELETE FROM eMints WHERE (RecordID =
@RecordID)">
<DeleteParameters>
<asp:Parameter Name="RecordID" Type="string" />
</DeleteParameters>
</asp:SqlDataSource>
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True"
AutoGenerateColumns="False" DataKeyNames="RecordID"
DataSourceID="SqlDataSource1" Font-Names="Arial" Width="749px">
<Columns>
<asp:BoundField DataField="RecordID"
HeaderText="RecordID" InsertVisible="False"
ReadOnly="True" SortExpression="RecordID"
Visible="False" />
<asp:BoundField DataField="LastName"
HeaderText="LastName" SortExpression="LastName" />
<asp:BoundField DataField="FirstName"
HeaderText="FirstName" SortExpression="FirstName" />
<asp:BoundField DataField="Location"
HeaderText="Location" SortExpression="Location" />
<asp:BoundField DataField="Phone" HeaderText="Phone"
SortExpression="Phone" />
<asp:BoundField DataField="Status" HeaderText="Status"
SortExpression="Status" >
<ItemStyle HorizontalAlign="Center" />
</asp:BoundField>
<asp:HyperLinkField DataTextField="UserName"
HeaderText="View Website"
Target="_blank" DataNavigateUrlFields="UserName"
DataNavigateUrlFormatString="http://emints.slps.org/emintwebsites/{0}">
<HeaderStyle Font-Underline="True" ForeColor="Blue"
/>
</asp:HyperLinkField>
<asp:TemplateField HeaderText="Remove User">
<ItemTemplate>
<asp:Button ID="Button1" runat="server"
CausesValidation="false" CommandName="Delete"
OnClientClick="javascript:return ConfirmDelete();"
Text="Delete" />
</ItemTemplate>
<ControlStyle ForeColor="Red" />
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle Font-Names="Arial" Font-Size="Medium"
Font-Underline="True" ForeColor="Blue" />
</asp:TemplateField>
</Columns>
<RowStyle Font-Size="Smaller" />
<EditRowStyle BackColor="White" ForeColor="White" />
<HeaderStyle Font-Size="Medium" />
<AlternatingRowStyle BackColor="#FFFFC0" />
</asp:GridView>

</div>
</form>
</body>
</html>

Mar 20 '06 #1
0 2372

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Mike N. | last post by:
Hello to all: First let me apologize for the length of this question, I've made an attempt to include as much information as is needed to help with the question. I am having problems putting...
5
by: pmud | last post by:
Hi, I need to display columns in a data grid based on 7 different queries. Now I have 32 questions: 1. Is it possble to have 1 single data adapter with 7 queries & 1 data set or do I need to...
12
by: pmud | last post by:
Hi, I am using teh following code for sorting the data grid but it doesnt work. I have set the auto generate columns to false. & set the sort expression for each field as the anme of that...
2
by: Stephan (Germany) | last post by:
Hello, maybe this qustion sounds silly but in VS2005, I'm looking for the same possibilty to entry data for a predefined XML schema in grid view. In VS2003, you were able to do it if you...
0
by: weiwei | last post by:
Hi, I have create a data grid view with delete button in VS 2005. so far I have able to display the data from database, howvever, there are two issues 1)I do not know how to call the delete...
0
by: Gian Paolo | last post by:
this is something really i can't find a reason. I have a form with a tabcontrol with tree pages, in the second page there is a Data GRid View. Plus i have a class. When i open the form i...
0
by: roamnet | last post by:
hi i created database file with .mdf extention ,sql server as a source and use grid view to display data there're no problem in data retrieve and display,but i want to edit it or insert new...
6
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1)...
1
by: amitjain123 | last post by:
Hello Friends, I have list box and grid view on screen. on selection of list box item, value of selected item gets added into grid view through java script. Now I want to generate the XML...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...

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.