c# - RadListView programatically add EditItemTemplate with ListView in aspx -
i have radlistview in aspx page has grouping, , works when in standard mode. i.e. using itemtemplate. when change edititemtemplate, edititemtemplate added code behind, doesn't seem display @ all.
i have edititemtemplate dynamically sets control type based on value. however, seems appear right @ bottom of screen, below buttons outside of listview, , isn't working grouping have.
so in page_prerender have (i've tried adding listview_prerender)
this.listview.edititemtemplate = new edititemtemplate(questionlist);
my edititemtemplate looks this:
public class edititemtemplate : itemplate { protected literalcontrol lcontrol; private readonly list<questionsvm> _questionlist; public edititemtemplate(list<questionsvm> questionlist) { _questionlist = questionlist; } public void instantiatein(control container) { if (count < _questionlist.count - 1) { htmltablerow row = new htmltablerow(); container.controls.add(row); row.attributes["class"] = "rlviedit"; tablehelper.addlabelfor(tablehelper.addcell(row), "questiongroup"); tablehelper.addlabelfor(tablehelper.addcell(row), "question"); var qtype = (enums.questiontypes)enum.parse(typeof(enums.questiontypes), _questionlist[count].displaytype); switch (qtype) { case enums.questiontypes.shorttext: case enums.questiontypes.longtext: tablehelper.addtextboxfor(tablehelper.addcell(row), "answer"); break; case enums.questiontypes.number: tablehelper.addnumerictextboxfor(tablehelper.addcell(row), "answer"); break; case enums.questiontypes.boolean: tablehelper.addcheckboxfor(tablehelper.addcell(row), "answer"); break; case enums.questiontypes.date: tablehelper.adddatetimefor(tablehelper.addcell(row), "answer"); break; default: throw new argumentoutofrangeexception(); } //container.controls.add(answer); count++; } }
here grouping in aspx page:
<datagroups> <telerik:listviewdatagroup groupfield="questiongroup" datagroupplaceholderid="datagroupplaceholder2"> <datagrouptemplate> <asp:panel runat="server" id="panel3" cssclass="datagroup" groupingtext='<%# (container).datagroupkey %>'> <asp:panel runat="server" id="itemplaceholder1" ></asp:panel> </asp:panel> </datagrouptemplate> <groupaggregates> <telerik:listviewdatagroupaggregate aggregate="count" datafield="questiongroup" /> </groupaggregates> </telerik:listviewdatagroup> </datagroups>
if have edititemtemplate 1 below, works ok doesn't have different controls.
<edititemtemplate> <table> <tr><td><br /></td></tr> <tr> <td> <asp:label id="label1" runat="server" text='<%# eval("question") %>'></asp:label> </td> <td> <telerik:radeditor id="textbox1" width="500" runat="server" text='<%# bind("answer") %>'></telerik:radeditor> </td> </tr> </table> </edititemtemplate>
any appreciated.
Comments
Post a Comment