Velocity Reviews

Velocity Reviews (
-   ASP .Net (
-   -   delete button and variable in NavigateUrl in VS2005 (

weiwei 03-16-2006 10:06 PM

delete button and variable in NavigateUrl in VS2005
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 command. 2), In my data
grid,<asp:HyperLinkField DataTextField="UserName" HeaderText="View
Website" NavigateUrl="" & text.UserName & ""
Target="_blank">, it doesn't work, I want that url
has the username as variable, anyone can help me out, thanks in
advance. below is my code,

<%@ Page Language="VB" Debug="true" %>

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

If Not Page.IsPostBack Then
End If

End Sub

Sub GridView1_RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs ) Handles

Dim RecordID As Button

Dim myConnection As String =
ConfigurationManager.ConnectionStrings("Connection String").ConnectionString
Dim strSQL As String = "DELETE FROM eMints WHERE RecordID = " &
RecordID & ""
Dim Connection As New
Dim myCommand As New Data.SqlClient.SqlCommand(strSQL,

End Sub

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"

<html xmlns="" >
<head runat="server">
<title>eMint Admin</title>
<form id="form1" runat="server">
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT [RecordID], [LastName], [FirstName],
[Location], [Phone], [Status], [UserName] FROM [eMints] ORDER BY

<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataKeyNames="RecordID"
DataSourceID="SqlDataSource1" Font-Names="Arial">
<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" />
<asp:BoundField DataField="UserName"
HeaderText="UserName" SortExpression="UserName" />
<asp:HyperLinkField DataTextField="UserName"
HeaderText="View Website" NavigateUrl="" &
text.UserName & ""
<HeaderStyle Font-Underline="True" ForeColor="Blue"
<asp:CommandField ButtonType="Button"
HeaderText="Remove User" ShowDeleteButton="True">
<HeaderStyle Font-Names="Arial" Font-Size="Medium"
Font-Underline="True" ForeColor="Blue" />
<ItemStyle ForeColor="White" />
<ControlStyle ForeColor="Red" />
<RowStyle Font-Size="Smaller" />
<EditRowStyle BackColor="White" ForeColor="White" />
<HeaderStyle Font-Size="Medium" />
<AlternatingRowStyle BackColor="#FFFFC0" />

All times are GMT. The time now is 01:49 PM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.