473,388 Members | 1,574 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,388 software developers and data experts.

DataGrid: asp:EditCommandColumn buttons does not call the _edit su

Hi,

The asp:EditCommandColumn template does not fire the _edit sutboutine
when the edit command column buttons are clicked. I get a Page Cannot Be
Displayed page error instead.

My (ASP 1.1) datagrid is defined in the HTML and the HTML <columns> has
one defined template column and it is an asp:EditCommandColumn (with edit
buttons). The datagrid's other columns are added at runtime by using the
technique documented in the MSDN article:

http://msdn.microsoft.com/library/de...ridcontrol.asp

The HTML is shown below in (1), the column class is shown in (2) and the
_edit subroutine signature is shown in (3).

Thank you for your help,

Scott

(1):
<ASP:DATAGRID id="MyDataGrid" runat="server" AutoGenerateColumns="False"
AllowSorting="True" Font-Names="Verdana"
AlternatingItemStyle-BackColor="Gainsboro"
OnItemDataBound="MyDataGrid_ItemBound" ShowFooter="True"
OnSortCommand="MyDataGrid_SortCommand" OnEditCommand="MyDataGrid_Edit"
OnCancelCommand="MyDataGrid_Cancel"
onDeleteCommand="MyDataGrid_DeleteCommand"
OnUpdateCommand="MyDataGrid_Update" BorderWidth="1px"
Font-Name="Verdana" Font-Size="8pt" HeaderStyle-BackColor="#aaaadd"
BorderColor="Black" CellPadding="3" Height="441px">
<HeaderStyle BackColor="#AAAADD" Wrap="False"></HeaderStyle>
<Columns> <asp:EditCommandColumn ButtonType="PushButton"
UpdateText="Ok" HeaderText="Edit Info" CancelText="Cancel"
EditText="Edit"> <HeaderStyle Wrap="False" HorizontalAlign="Center"
Width="50px"></HeaderStyle>
<ItemStyle Wrap="False" Width="50px"></ItemStyle>
</asp:EditCommandColumn>
</Columns>
</ASP:DATAGRID>

(2):
Public Class DynamicDataGridTemplate
Implements ITemplate
Dim templateType As ListItemType
Dim columnName As String
Dim ColumnNum As Integer

Sub New(ByVal type As ListItemType, ByVal ColName As String, ByVal ColNum
As Integer)
templateType = type
columnName = ColName
columnNum = ColNum
End Sub

Sub InstantiateIn(ByVal container As Control) _
Implements ITemplate.InstantiateIn

Dim lc As New Literal
Dim chkBox1 As New CheckBox
Dim chkBox2 As New CheckBox
Select Case templateType
Case ListItemType.Header
If ColumnNum = 0 Then
lc.Text = "<B>" & columnName & "</B><BR>"
container.Controls.Add(lc)
Else
lc.Text = "<B>" & columnName & "</B><BR>"
container.Controls.Add(lc)
If ColumnNum = 1 Then
chkBox1.Text = "Asc"
If columnName.StartsWith("Acad") Then
chkBox1.Checked = False
Else
chkBox1.Checked = True
End If

chkBox1.ID = "chkBox" & ColumnNum
container.Controls.Add(chkBox1)
If columnName.StartsWith("Acad") Then
chkBox2.Checked = True
Else
chkBox2.Checked = False
End If
chkBox2.Text = "Desc"
chkBox2.ID = "chkBox" & ColumnNum
container.Controls.Add(chkBox2)
Else
chkBox1.Text = "Asc"
chkBox1.ID = "chkBox" & ColumnNum
container.Controls.Add(chkBox1)
chkBox2.Text = "Desc"
chkBox2.ID = "chkBox" & ColumnNum
container.Controls.Add(chkBox2)
End If
End If
Case ListItemType.Item
lc.Text = "Item " & columnName
container.Controls.Add(lc)
Case ListItemType.EditItem
Dim tb As New TextBox
tb.Text = ""
container.Controls.Add(tb)
Case ListItemType.Footer
lc.Text = "<I>Footer</I>"
container.Controls.Add(lc)
End Select
End Sub
End Class

(3):
Sub MyDataGrid_Edit(ByVal sender As Object, ByVal e As
DataGridCommandEventArgs) Handles MyDataGrid.EditCommand
Jun 20 '06 #1
0 1268

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

Similar topics

1
by: Rick | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls...
0
by: Richard Ryerson | last post by:
Hello all, I hope all is well with you. I am having a seriously difficult time with this problem. Allow me to set up the problem. I have a System.Web.UI.Page with the following controls (watch...
6
by: Scott McDaniel | last post by:
I'm using Visual Studio 2005 with the .NET 2.0.50727 framework, and we're using the standard Datagrid control bound to a SQL Server. We have two groups of users - "full edit" users, and "view...
0
by: slemen | last post by:
Hi, The DataGrid aps:EditCommandColumn when used with column templates created programmatically does not trigger the _Edit subroutine in code. The ASP:Datagrid definition is below (1), the...
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: 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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

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.