harmmeijer
Programmer
My datalist loads its edititemtemplate dynamically because it lists an array of documents.
There are about 10 classes that inherrit from document (like passport or driving licsence).
The datasource of the datalist is an array of documents (so they could be passports or driving licsence or ...)
When the edit command is clicked I get the correct template:
Dim dc As document = lstDocuments.DataSource(lstDocuments.EditItemIndex)
lstDocuments.EditItemTemplate = Page.LoadTemplate(dc.getEditItemTemplate)
here is what a passport template looks like
The thing is when I click the update link the OnUpdateCommand does not get called.
When I don't load my editItemTemplate dynamically and put the following code in the datalist
Than the OnUpdateCommand will get called when I click the link.
How can I update a record of my datalist without hard coding the editItemTemplate?
this sample
and many that are basically the same show how to load a template dynamically but I could not find one that can update
a record as well
Greetings, Harm Meijer
There are about 10 classes that inherrit from document (like passport or driving licsence).
The datasource of the datalist is an array of documents (so they could be passports or driving licsence or ...)
When the edit command is clicked I get the correct template:
Dim dc As document = lstDocuments.DataSource(lstDocuments.EditItemIndex)
lstDocuments.EditItemTemplate = Page.LoadTemplate(dc.getEditItemTemplate)
here is what a passport template looks like
Code:
<%@ Language="vb" %>
<h1>Edit your passport</h1><br>
<hr>
<asp:TextBox
ID="txtFirstName"
Runat="server"
text='<%#DataBinder.Eval(CType(Container, DataListItem).DataItem, "firstname")%>'
>
</asp:TextBox>
<asp:TextBox
ID="txtLastName"
Runat="server"
text='<%#DataBinder.Eval(CType(Container, DataListItem).DataItem, "lastname")%>'
>
</asp:TextBox><br>
<asp:LinkButton id="UpdateButton"
Text="Update"
CommandName="Update"
runat="server"/>
The thing is when I click the update link the OnUpdateCommand does not get called.
When I don't load my editItemTemplate dynamically and put the following code in the datalist
Code:
<EditItemTemplate >
<asp:LinkButton id="UpdateButton"
Text="Update"
CommandName="Update"
runat="server"/>
</EditItemTemplate>
Than the OnUpdateCommand will get called when I click the link.
How can I update a record of my datalist without hard coding the editItemTemplate?
this sample
and many that are basically the same show how to load a template dynamically but I could not find one that can update
a record as well
Greetings, Harm Meijer