Answered by:
How to get reference of label inside the objectlist control...? -- Urgent

Question
-
User1804643598 posted
Hi All,
I am using object list control inside that i used listcontrol, Now in ItemDataBind event how do i get the reference of that label & also how do get the footer template reference.
<mobile:ObjectList ID="olQns" Runat="server" Alignment="Left" CommandStyle-StyleReference="subcommand"
LabelField="PKQuestionId" AutoGenerateFields="False"
LabelStyle-StyleReference="title" OnItemDataBind="olQns_ItemDataBind">
<Command Name="Acknowledge" Text="Acknowledge" />
<DeviceSpecific>
<Choice Xmlns="http://schemas.microsoft.com/mobile/html32template">
<ItemTemplate>
<mobile:Label ID="ID" Runat="server" Text='<%# Eval("No") %>' BreakAfter="False">
</mobile:Label>
<mobile:Label ID="Label1" Runat="server" Text='<%# Eval("Qns") %>'>
</mobile:Label>
<mobile:SelectionList ID="slAns" Runat="server" SelectType="Radio"></mobile:SelectionList>
</ItemTemplate>
<FooterTemplate>
<mobile:Label ID="Label4" Runat="server">My Footer</mobile:Label>
</FooterTemplate>
</Choice>
</DeviceSpecific>
<Field DataField="SlNo" Title="No" />
<Field DataField="Question1" Title="Qns" />
</mobile:ObjectList>In this itemDatabind i want to know the in which template the item is there and that control reference.
protected void olQuestions_ItemDataBind(object sender, ObjectListDataBindEventArgs e)
{}
Tuesday, April 20, 2010 10:47 PM
Answers
-
User556320390 posted
see, as for now i dont have the work around to check for it, but let me try...
my guess is that if we can loop the objectlist, then item property of the list will get us the complete listrow, then you can find the controls available in it, but sorry if i am worng, .......
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, April 21, 2010 12:54 AM
All replies
-
User556320390 posted
using the findcontrol you can get the control in the itemdatabind method, but dont forget to cast the object to the type of it
and then the object.FooterRow will get you the controls in the footertemplate, again in their you have to use the Findcontrol to get control...
Wednesday, April 21, 2010 12:25 AM -
User1804643598 posted
Hi dinudany,
Thank you reply. Using findcontrol i will get the reference i know that but i am getting error because i am not checked on which template is that label is exist. Now can you help me how to check template type. I know in grid view we will check with the rowtype but in objectlist how we check that one.
Eg: in gridview we will check that
if (e.Row.RowType == DataControlRowType.DataRow)
{
}
It is urgent to me
Wednesday, April 21, 2010 12:40 AM -
User556320390 posted
see, as for now i dont have the work around to check for it, but let me try...
my guess is that if we can loop the objectlist, then item property of the list will get us the complete listrow, then you can find the controls available in it, but sorry if i am worng, .......
- Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
Wednesday, April 21, 2010 12:54 AM