471,318 Members | 1,987 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,318 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 988

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by ShadowsOfTheBeast | last post: by
4 posts views Thread by Richard Roche | last post: by
3 posts views Thread by Jim Heavey | last post: by
4 posts views Thread by Stephan Bour | last post: by
6 posts views Thread by Scott McDaniel | last post: by
8 posts views Thread by Matt | last post: by
reply views Thread by rosydwin | last post: by

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.