By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
445,909 Members | 2,016 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 445,909 IT Pros & Developers. It's quick & easy.

pass variable in data grid view

P: n/a
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
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
<html xmlns="" >
<head runat="server">
<title>eMint Admin</title>
<script language=javascript>
function ConfirmDelete(){
return confirm('Are you sure want to delete this user
<form id="form1" runat="server">
<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
DeleteCommand="DELETE FROM eMints WHERE (RecordID =
<asp:Parameter Name="RecordID" Type="string" />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataKeyNames="RecordID"
DataSourceID="SqlDataSource1" Font-Names="Arial" Width="749px">
<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:HyperLinkField DataTextField="UserName"
HeaderText="View Website"
Target="_blank" DataNavigateUrlFields="UserName"
<HeaderStyle Font-Underline="True" ForeColor="Blue"
<asp:TemplateField HeaderText="Remove User">
<asp:Button ID="Button1" runat="server"
CausesValidation="false" CommandName="Delete"
OnClientClick="javascript:return ConfirmDelete();"
Text="Delete" />
<ControlStyle ForeColor="Red" />
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle Font-Names="Arial" Font-Size="Medium"
Font-Underline="True" ForeColor="Blue" />
<RowStyle Font-Size="Smaller" />
<EditRowStyle BackColor="White" ForeColor="White" />
<HeaderStyle Font-Size="Medium" />
<AlternatingRowStyle BackColor="#FFFFC0" />


Mar 20 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.