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

Datagrid Template Column

I have an ASP.Net datagrid with a template column. At design time I added an
asp:panel to a template column.
I have enabled the Edit,Update, Cancel commands. At runtime in the
Datagrid_ItemCreated event. I check the ItemType for Edit Item Type, then I
get the reference to the Panel in the column and add some new
controls(textboxes) to the panel. I set the ID for the new controls with a
unique ID. This works great the controls are created and displayed and I can
edit the data in the controls. However when I click the "Update Button" my
Panel is coming back empty. I have the Sub that handles the UpdateCommand.
It is being called and I can get a reference to the Panel but the Panel
seems to have lost all its controls. I am looking for some help resolving
this issue.

Sample of the Code:
Sub MyDataGrid_ItemCreated()
oPanelTitle = CType(e.Item.FindControl("pnlNewTitle"), Panel)
oTableTitle = New Table
For Each oLanguage In _LanguageList
'Create a new tablerow
oTRTitle = New TableRow
'Create a new tablecell
oTDTitle = New TableCell
oTDTitle.Text = oLanguage.Name
'Add the tablecell to the tablerow
oTRTitle.Controls.Add(oTDTitle)

oTDTitle = New TableCell
oTDTitle.VerticalAlign = VerticalAlign.Top
oText = New TextBox
oText.ID = EDITTITLE & oLanguage.LCID
oText.Text = oArticle.Title
oTDTitle.Controls.Add(oText)
oTRTitle.Controls.Add(oTDTitle)
'Add the tablerow to the table
oTableTitle.Controls.Add(oTRTitle)
Next
'Add the table to the panel
oPanelTitle.Controls.Add(oTableTitle)

End Sub

Sub MyDataGrid_Update()
Dim TitleTextBox As TextBox
TitleTextBox = E.Item.Cells.Item(5).FindControl(NEWTITLE &
oLanguage.LCID)
End Sub

Thanks Neal
Jul 21 '05 #1
0 1032

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

Similar topics

4
by: ShadowsOfTheBeast | last post by:
hi oliver thanks for your help i kinda figured that out minutes afterwards...but what i am actually trying to do is this: i have a listbox control that gets its data from another listbox (hence...
4
by: Richard Roche | last post by:
Is it possible to use a drop combo instead of a text box when using the EditCommand in the Datagrid? Many table columns are bound to 'lookup' tables, user's don't care about the foreign keys,...
2
by: damonf | last post by:
I'm currently trying to add an ASP hyperlink to a template column in a datagrid. The normal hyperlink column doesn't give me the ability to add attributes to the item. In my grid there are four...
3
by: Jim Heavey | last post by:
Trying to figure out the technique which should be used to add rows to a datagrid. I am thinking that I would want an "Add" button on the footer, but I am not quite sure how to do that. Is that...
4
by: Stephan Bour | last post by:
Hi, I have a datagrid databound to a SQL query. I'd like to allow editing of some columns but not all. Is there a way to turn off the conversion of the datagrid cells to textboxes for some columns...
1
by: RN | last post by:
Hi. I used this article to add a template column to a datagrid that is entirely created with code: ...
1
by: Ken Varn | last post by:
I have a problem where my DataGrid would not maintain the ViewState of my databound rows. I finally narrowed down the problem. If my first column is a template column, the view state for the...
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...
2
by: Charleees | last post by:
Hi all, I have a DataGrid with Template Columns..... There are LAbels,Linkbuttons in the Single Row.. I have to set the Constant Column width for those Template Columns in Grid... Wat...
8
by: Matt | last post by:
Guys I could really use some help with this. I think that it's probably a simple solution but I haven't been able to find anything. I have a datagrid on my form that I populate via code like...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
0
by: jianzs | last post by:
Introduction Cloud-native applications are conventionally identified as those designed and nurtured on cloud infrastructure. Such applications, rooted in cloud technologies, skillfully benefit from...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: stefan129 | last post by:
Hey forum members, I'm exploring options for SSL certificates for multiple domains. Has anyone had experience with multi-domain SSL certificates? Any recommendations on reliable providers or specific...
1
by: davi5007 | last post by:
Hi, Basically, I am trying to automate a field named TraceabilityNo into a web page from an access form. I've got the serial held in the variable strSearchString. How can I get this into the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...

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.