Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Help Newbie with datagrid

Status
Not open for further replies.

TimothyP

Programmer
Aug 6, 2002
135
US
Application: VB.NET 2003
DB: SQL Serer 2000

I am trying to write a simple application to Select/Insert/Update/Delete records of a SQL server table. I am trying to accomplish this task using a Datagrid.

I can display my table with the Edit & Update buttons.
However, I have to double-click on the button before I see the Update button. I just want this button to be a single click. Below is my code. Any ides?

Thanks in advance!

Tim

Code:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="index.aspx.vb" Inherits="MySpecialEventsCost2.WebForm1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
	<HEAD>
		<title>WebForm1</title>
		<meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR">
		<meta content="Visual Basic .NET 7.1" name="CODE_LANGUAGE">
		<meta content="JavaScript" name="vs_defaultClientScript">
		<meta content="[URL unfurl="true"]http://schemas.microsoft.com/intellisense/ie5"[/URL] name="vs_targetSchema">
	</HEAD>
	<body>
		<form id="Form1" method="post" runat="server">
			<asp:DataGrid id="dgStatusMaster" runat="server" DataKeyField="Status_id" AutoGenerateColumns="False">
				<Columns>
					<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update" CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
					<asp:ButtonColumn Text="Delete" ButtonType="PushButton" CommandName="Delete"></asp:ButtonColumn>
					<asp:TemplateColumn SortExpression="status_id" HeaderText="Status ID">
						<ItemTemplate>
							<asp:Label id=Label1 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.status_id") %>'>
							</asp:Label>
						</ItemTemplate>
					</asp:TemplateColumn>
					<asp:TemplateColumn SortExpression="status_description" HeaderText="status_description">
						<ItemTemplate>
							<asp:Label id=Label3 runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.status_description") %>'>
							</asp:Label>
						</ItemTemplate>
						<EditItemTemplate>
							<asp:RequiredFieldValidator id="RequiredFieldValidator1" runat="server" ErrorMessage="The status description is empty."
								Display="None" ControlToValidate="StatusDescription">Product name is empty.</asp:RequiredFieldValidator>
							<asp:TextBox id="StatusDescription" Width="110" MaxLength="40" runat="server" Text='<%# DataBinder.Eval(Container, "DataItem.status_description") %>'>
							</asp:TextBox>
						</EditItemTemplate>
					</asp:TemplateColumn>
				</Columns>
			</asp:DataGrid></form>
	</body>
</HTML>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top