T
tshad
I found I can create Template columns dynamically - as long as I don't use
objects that need onclick events, such as a LinkButton. Textboxes and
Labels work fine.
I create the Template columns like so:
Dim column as TemplateColumn = new TemplateColumn()
column.HeaderText = "Template Column"
column.ItemStyle.Width = Unit.Pixel(width)
column.HeaderStyle.Width = Unit.Pixel(width)
column.ItemTemplate = Page.LoadTemplate("testTEmplateColumn2.ascx")
' column.OnClick="Resume_Submit"
This seems to work fine (notice I have the OnClick commented out)
The .ascx file is:
<%@ Language="VB" %>
<asp:LinkButton id="ResumeDate"
text="test"
visible="true"
width="80px"
runat="server"/>
As it is it works fine - but doesn't do anything.
If I added:
OnClick="Resume_Submit"
I get the error:
'resume_submit' is not a member of 'ASP.testTemplateColumn2_ascx'.
So I tried to do it where I create the TemplateColumn (the line that is
commented out). If I uncomment it I get:
'OnClick' is not a member of 'System.Web.UI.WebControls.TemplateColumn'.
This makes sense as the ID is on the LinkButton and not the TemplateColumn -
How would I access it from the TemplateColumn to set it?
Thanks,
Tom
objects that need onclick events, such as a LinkButton. Textboxes and
Labels work fine.
I create the Template columns like so:
Dim column as TemplateColumn = new TemplateColumn()
column.HeaderText = "Template Column"
column.ItemStyle.Width = Unit.Pixel(width)
column.HeaderStyle.Width = Unit.Pixel(width)
column.ItemTemplate = Page.LoadTemplate("testTEmplateColumn2.ascx")
' column.OnClick="Resume_Submit"
This seems to work fine (notice I have the OnClick commented out)
The .ascx file is:
<%@ Language="VB" %>
<asp:LinkButton id="ResumeDate"
text="test"
visible="true"
width="80px"
runat="server"/>
As it is it works fine - but doesn't do anything.
If I added:
OnClick="Resume_Submit"
I get the error:
'resume_submit' is not a member of 'ASP.testTemplateColumn2_ascx'.
So I tried to do it where I create the TemplateColumn (the line that is
commented out). If I uncomment it I get:
'OnClick' is not a member of 'System.Web.UI.WebControls.TemplateColumn'.
This makes sense as the ID is on the LinkButton and not the TemplateColumn -
How would I access it from the TemplateColumn to set it?
Thanks,
Tom