_EditCommand not firing...

J

jef

I realize this should be simple... but I'm at my wits end. I'm new to
ASP.NET (.NET in general) but have many years experience with VB6. I
have a very simple Datagrid with 2 columns bound to a datasource. I
have a ButtonColumn in the grid (my grid is called grdShow). My code
behind has a grdShow_EditCommand() function which handles
grdshow.EditCommand... but it doesn't fire when I click the Edit
button. I've searched for days on this and everything I find eludes to
adding an "OnEditCommand=xxxxxx" attribute to the grid in the .aspx
file. I can't find anything documented to show me how to do this... Am
I naive to think that I shouldn't have to "hard-wire" all of the
events... this is beginning to feel like a step back in technology...
not forward...
 
B

Brock Allen

Without seeing more code, I can't quite be sure what your problems is, but
a comment about something you mentioned:
this is beginning to feel like a step back in technology...
not forward...

HTML/browser based applications *are* a step backwards from the deskstop
style applications you're used to in terms of presentation and responsiveness.
But it's the price to pay for a no-client install since "all they need is
a browser". If someone (your boss) asks you to reproduce 100% of the functionality
from your VB6 app in ASP.NET you need to have a nice long chat with them...
This isn't the same environment. Now... having said that, as long as expectations
are set properly, you can (and I'm sure you will) build great apps in ASP.NET.
Just be aware that it's a different paradigm with its own pros and cons. :)
 
J

jef

Here is the .aspx file:
<%@ Page Language="vb" AutoEventWireup="false"
Codebehind="refShow.aspx.vb" Inherits="refShow"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title>Show Reference</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="http://schemas.microsoft.com/intellisense/ie5"
name="vs_targetSchema">
</HEAD>
<body background="../Graphics/bg_fnr.jpg" MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:datagrid id="grdShow" style="Z-INDEX: 101; LEFT: 40px;
POSITION: absolute; TOP: 80px" runat="server"
GridLines="Horizontal" AutoGenerateColumns="False" Height="152px"
Width="664px">
<EditItemStyle BackColor="#C0C0FF"></EditItemStyle>
<Columns>
<asp:BoundColumn DataField="Show_Name" HeaderText="Show
Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Show_Description"
HeaderText="Description"></asp:BoundColumn>
<asp:EditCommandColumn ButtonType="PushButton" UpdateText="Update"
CancelText="Cancel" EditText="Edit"></asp:EditCommandColumn>
</Columns>
</asp:datagrid><asp:image id="Image1" style="Z-INDEX: 102; LEFT:
-8px; POSITION: absolute; TOP: 0px" runat="server"
Height="60px" Width="800px"
ImageUrl="file:///C:\Inetpub\wwwroot\FNR\Graphics\hd_fnr_generic_1.jpg"></asp:image></form>
</body>
</HTML>

Here is the code behind (.vb) :
Imports FNR.BusinessLogicLayer

Public Class refShow
Inherits System.Web.UI.Page

#Region " Web Form Designer Generated Code "

'This call is required by the Web Form Designer.
<System.Diagnostics.DebuggerStepThrough()> Private Sub
InitializeComponent()

End Sub
Protected WithEvents grdShow As System.Web.UI.WebControls.DataGrid
Protected WithEvents Image1 As System.Web.UI.WebControls.Image

'NOTE: The following placeholder declaration is required by the Web
Form Designer.
'Do not delete or move it.
Private designerPlaceholderDeclaration As System.Object

Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub

#End Region

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
If Not Page.IsPostBack Then
BindFields()
End If
End Sub

Private Sub BindFields()
grdShow.DataSource = Show.getRecords()
grdShow.DataBind()
End Sub


Private Sub grdShow_EditCommand(ByVal source As Object, ByVal e As
System.Web.UI.WebControls.DataGridCommandEventArgs) Handles
grdShow.EditCommand
Debug.WriteLine("This never fires!")
End Sub
End Class
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,576
Members
45,054
Latest member
LucyCarper

Latest Threads

Top