Asked by:
Lazy Loading in .ascx file not working

Question
-
User1983487377 posted
Hi i m using lazy loading in my control
i am using Tabcontrainer to implement lazy loading and i have got the reference from the here
this link contain example in .aspx but i want it in my user control
i am perfect at all the required changes but i m getting an error as <Red>"Tabcontainer is undefined" </Red>
and i cant access my database / function
in this example ,.... they are using datasource but i want to bind my grid at runtime by code according to my query
Thanx in advance...
Friday, July 18, 2008 3:30 AM
All replies
-
User481221548 posted
Hi there
Show us relevant Code to this.
Friday, July 18, 2008 8:26 AM -
User1983487377 posted
Thanx for reply
but i have cleared my queries
now the final code is somethink like this
1 <style> 2 .updateProgress 3 { 4 /*border-width:1px; 5 border-style:solid; 6 background-color:#CCCCCC; */ 7 background: url(imagesjet/member_login_bg.gif) no-repeat; 8 ; 9 width:130px; 10 height:auto; 11 12 } 13 .updateProgressMessage 14 { 15 /*margin:3px; */ 16 font-family:Trebuchet MS; 17 font-size:small; 18 font-weight: bolder; 19 vertical-align: middle; 20 } 21 </style> 22 <asp:ScriptManager id="<span" class="st">"ScriptManager1" runat="server" /> 23 24 <script type="<span" class="st">"text/javascript" language="javascript"> 25 26 var _updateProgressDiv; 27 28 function pageLoad(sender, args){ 29 // register for our events 30 Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequest); 31 Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequest); 32 33 _updateProgressDiv = $get('updateProgressDiv'); 34 } 35 36 function beginRequest(sender, args){ 37 // get the gridview element 38 var tabContainer = $get('<%= this.TabContainer2.ClientID %>'); 39 40 // make it visible 41 _updateProgressDiv.style.display = ''; 42 43 // get the bounds of both the gridview and the progress div 44 var tabContainerwBounds = Sys.UI.DomElement.getBounds(tabContainer); 45 var updateProgressDivBounds = Sys.UI.DomElement.getBounds(_updateProgressDiv); 46 47 var x = tabContainerwBounds.x + Math.round(tabContainerwBounds.width / 2) - Math.round(updateProgressDivBounds.width / 2); 48 var y = tabContainerwBounds.y + Math.round(tabContainerwBounds.height / 2) - Math.round(updateProgressDivBounds.height / 2); 49 50 51 // set the progress element to this position 52 Sys.UI.DomElement.setLocation (_updateProgressDiv, x, y); 53 } 54 55 function endRequest(sender, args) { 56 // make it invisible 57 _updateProgressDiv.style.display = 'none'; 58 } 59 60 function ClientVoteClick(sender, args) { 61 // see if the table elements for the grids exist yet 62 63 var tabContainer = $get('<%= this.TabContainer2.ClientID %>'); 64 if( tabContainer.get_activeTabIndex() == 0){ 65 // load tab1 66 __doPostBack('<%= btnMyPollTrigger.UniqueID %>', ''); 67 } 68 else if( tabContainer.get_activeTabIndex() == 1){ 69 // load tab2 70 __doPostBack('<%= btnVotedPollTrigger.UniqueID %>', ''); 71 } 72 else if( tabContainer.get_activeTabIndex() == 2){ 73 // load tab3 74 __doPostBack('<%= btnUnVotedPollTrigger.UniqueID %>', ''); 75 } 76 77 78 } 79 function clientActiveTabChanged(sender, args) { 80 81 // see if the table elements for the grids exist yet 82 var isTab1Loaded = $get('<%= this.GrvMyPoll.ClientID %>'); 83 var isTab2Loaded = $get('<%= this.GrvVoted.ClientID %>'); 84 var isTab3Loaded = $get('<%= this.GrvUnvoted.ClientID %>'); 85 86 87 88 89 if( sender.get_activeTabIndex() == 0){ 90 // load tab1 91 __doPostBack('<%= btnMyPollTrigger.UniqueID %>', ''); 92 } 93 else if( sender.get_activeTabIndex() == 1){ 94 // load tab2 95 __doPostBack('<%= btnVotedPollTrigger.UniqueID %>', ''); 96 } 97 else if( sender.get_activeTabIndex() == 2){ 98 // load tab3 99 __doPostBack('<%= btnUnVotedPollTrigger.UniqueID %>', ''); 100 } 101 102 } 103 104 </script> 105 </asp:ScriptManager>
"updateProgressDiv" class="updateProgress" style="display: none;"> 106111 <input id="<span" class="st">"btnMyPollTrigger" runat="server" type="button" style="display: none" onserverclick="btnMyPollTrigger_ServerClick" /> 112 <input id="<span" class="st">"btnVotedPollTrigger" runat="server" type="button" style="display: none" 113 onserverclick="btnVotedPollTrigger_ServerClick" /> 114 <input id="<span" class="st">"btnUnVotedPollTrigger" runat="server" type="button" style="display: none" 115 onserverclick="btnUnVotedPollTrigger_ServerClick" /> 116 <cc1:TabContainer id="<span" class="st">"TabContainer2" runat="server" ActiveTabIndex="1" Style="float: left;" 117 CssClass="ajax__tab_ie-theme" OnClientActiveTabChanged="clientActiveTabChanged"> 118 <cc1:TabPanel id="<span" class="st">"TabPanel1" runat="server" HeaderText="TabPanel1"> 119 <HeaderTemplate> 120 My Poll 121 </HeaderTemplate> 122 <ContentTemplate> 123 <asp:UpdatePanel id="<span" class="st">"UpdatePanel4" runat="server" UpdateMode="Conditional"> 124 <ContentTemplate> 125 <asp:GridView id="<span" class="st">"GrvMyPoll" Width="95%" AutoGenerateColumns="False" runat="server" 126 GridLines="None" OnRowCommand="GvPollList_RowCommand" OnRowDataBound="GvPollList_RowDataBound" 127 AllowPaging="True" OnPageIndexChanging="GvPollList_PageIndexChanging" ShowFooter="True" 128 BorderColor="Silver" BorderStyle="Solid" BorderWidth="2px" EmptyDataText="There are no poll in the list" 129 Style="width:100% "> 130 <Columns> 131 <asp:TemplateField headertext="<span" class="st">"Poll List"> 132 <ItemTemplate> 133 </ItemTemplate></asp:TemplateField></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel></ContentTemplate></cc1:TabPanel></cc1:TabContainer>"center"> 107110"images/40.gif" /> 108 class="updateProgressMessage">Loading ... 109
"100%"> 134
161135 148"left" rowspan="3"> 136 <asp:Image id="<span" class="st">"Image1" runat="server" ImageUrl='<%# Eval("UserId","~/Admin/UserImages/img{0}.jpg") %>' 137 Height="75px" Width="75px" /></asp:Image> 138"2" align="left" style="width: 300px"> 139 <asp:LinkButton id="<span" class="st">"LinkButton1" runat="server" CommandArgument='<%# Bind("Poll_Id") %>' 140 PostBackUrl="~/#Top" CommandName="SelectPoll"> 141 <asp:Label id="<span" class="st">"QuestionLabel" runat="server" Text='<%# Bind("Poll_Question") %>'></asp:Label> 142 </asp:LinkButton> 143 144"right"> 145 <asp:Label id="<span" class="st">"LblAgo" runat="server" Text='<%# Counttime(Eval("Polldate","{0}"))%>' /> 146 </asp:Label> 147149 154"left"> 150 Posted By : 151 <asp:Label id="<span" class="st">"Labal" runat="server" Text='<%# Bind("Name") %>' /></asp:Label> 152 153155 160"left"> 156 Total Votes : 157 <asp:Label id="<span" class="st">"Label2" runat="server" Text='<%# Bind("Total") %>' /> 158 </asp:Label> 159
162 163 164 <asp:TemplateField> 165 <ItemTemplate> 166 <asp:ImageButton id="<span" class="st">"ImageButton1" CommandName="CmdDeletePoll" CommandArgument='<%# Bind("Poll_Id") %>' 167 ImageUrl="~/images/1d.gif" runat="server" /> 168 <cc1:ConfirmButtonExtender id="<span" class="st">"ConfirmButtonExtender1" runat="server" ConfirmText="Are you sure ?" 169 TargetControlID="ImageButton1"> 170 </cc1:ConfirmButtonExtender> 171 </asp:ImageButton> 172 </ItemTemplate> 173 </asp:TemplateField> 174 <PagerStyle backcolor="<span" class="st">"Silver" ForeColor="White" HorizontalAlign="Center" /> 175 <HeaderStyle horizontalalign="<span" class="st">"Left" BackColor="#7F9db9" /> 176 <EmptyDataRowStyle font-bold="<span" class="st">"False" Font-Size="Medium" ForeColor="Red" HorizontalAlign="Center" /> 177 <PagerSettings position="<span" class="st">"TopAndBottom" /> 178 </PagerSettings> 179 </EmptyDataRowStyle> 180 <Triggers> 181 <asp:AsyncPostBackTrigger controlid="<span" class="st">"btnMyPollTrigger" /> 182 </asp:AsyncPostBackTrigger> 183 </Triggers> 184 </HeaderStyle> 185 </PagerStyle> 186 <cc1:TabPanel id="<span" class="st">"TabPanel2" runat="server" HeaderText="TabPanel2"> 187 <HeaderTemplate> 188 Voted Poll 189 </HeaderTemplate> 190 <ContentTemplate> 191 <asp:UpdatePanel id="<span" class="st">"UpdatePanel3" runat="server" UpdateMode="Conditional"> 192 <ContentTemplate> 193 <asp:GridView id="<span" class="st">"GrvVoted" Width="95%" AutoGenerateColumns="False" runat="server" 194 GridLines="None" OnRowCommand="GvPollList_RowCommand" OnRowDataBound="GvPollList_RowDataBound" 195 AllowPaging="True" OnPageIndexChanging="GvPollList_PageIndexChanging" ShowFooter="True" 196 BorderColor="Silver" BorderStyle="Solid" BorderWidth="2px" EmptyDataText="There are no poll in the list" 197 Style=""> 198 <Columns> 199 <asp:TemplateField headertext="<span" class="st">"Poll List"> 200 <ItemTemplate> 201 </ItemTemplate></asp:TemplateField></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel></ContentTemplate></cc1:TabPanel>"100%"> 202
229203 216"3"> 204 <asp:Image id="<span" class="st">"Image1" runat="server" ImageUrl='<%# Eval("UserId","~/Admin/UserImages/img{0}.jpg") %>' 205 Height="75px" Width="75px" /></asp:Image> 206"2" align="left" style="width: 300px"> 207 <asp:LinkButton id="<span" class="st">"LinkButton1" runat="server" CommandArgument='<%# Bind("Poll_Id") %>' 208 PostBackUrl="~/#Top" CommandName="SelectPoll"> 209 <asp:Label id="<span" class="st">"QuestionLabel" runat="server" Text='<%# Bind("Poll_Question") %>'></asp:Label> 210 </asp:LinkButton> 211 212"right"> 213 <asp:Label id="<span" class="st">"LblAgo" runat="server" Text='<%# Counttime(Eval("Polldate","{0}"))%>' /> 214 </asp:Label> 215217 222"width: 110px"> 218 Posted By : 219 <asp:Label id="<span" class="st">"Labal" runat="server" Text='<%# Bind("Name") %>' /></asp:Label> 220 221223 228"width: 110px"> 224 Total Votes : 225 <asp:Label id="<span" class="st">"Label2" runat="server" Text='<%# Bind("Total") %>' /> 226 </asp:Label> 227
230 231 232 <asp:TemplateField> 233 <ItemTemplate> 234 <asp:ImageButton id="<span" class="st">"ImageButton1" CommandName="CmdDeletePoll" CommandArgument='<%# Bind("Poll_Id") %>' 235 ImageUrl="~/images/1d.gif" runat="server" /> 236 <cc1:ConfirmButtonExtender id="<span" class="st">"ConfirmButtonExtender1" runat="server" ConfirmText="Are you sure ?" 237 TargetControlID="ImageButton1"> 238 </cc1:ConfirmButtonExtender> 239 </asp:ImageButton> 240 </ItemTemplate> 241 </asp:TemplateField> 242 <PagerStyle backcolor="<span" class="st">"Silver" ForeColor="White" HorizontalAlign="Center" /> 243 <HeaderStyle horizontalalign="<span" class="st">"Left" BackColor="#7F9DB9" /> 244 <EmptyDataRowStyle font-bold="<span" class="st">"False" Font-Size="Medium" ForeColor="Red" HorizontalAlign="Center" /> 245 <PagerSettings position="<span" class="st">"TopAndBottom" /> 246 </PagerSettings> 247 </EmptyDataRowStyle> 248 <Triggers> 249 <asp:AsyncPostBackTrigger controlid="<span" class="st">"btnVotedPollTrigger" /> 250 </asp:AsyncPostBackTrigger> 251 </Triggers> 252 </HeaderStyle> 253 </PagerStyle> 254 <cc1:TabPanel id="<span" class="st">"TabPanel3" runat="server" HeaderText="TabPanel3"> 255 <HeaderTemplate> 256 Unvoted Poll 257 </HeaderTemplate> 258 <ContentTemplate> 259 <asp:UpdatePanel id="<span" class="st">"UpdatePanel2" runat="server" UpdateMode="Conditional"> 260 <ContentTemplate> 261 <asp:GridView id="<span" class="st">"GrvUnvoted" Width="95%" AutoGenerateColumns="False" runat="server" 262 GridLines="None" OnRowCommand="GvPollList_RowCommand" OnRowDataBound="GvPollList_RowDataBound" 263 AllowPaging="True" OnPageIndexChanging="GvPollList_PageIndexChanging" ShowFooter="True" 264 BorderColor="Silver" BorderStyle="Solid" BorderWidth="2px" EmptyDataText="There are no poll in the list" 265 Style=""> 266 <Columns> 267 <asp:TemplateField headertext="<span" class="st">"Poll List"> 268 <ItemTemplate> 269 </ItemTemplate></asp:TemplateField></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel></ContentTemplate></cc1:TabPanel>270
305271 284"left" rowspan="3"> 272 <asp:Image id="<span" class="st">"Image1" runat="server" ImageUrl='<%# Eval("UserId","~/Admin/UserImages/img{0}.jpg") %>' 273 Height="75px" Width="75px" /></asp:Image> 274"2" align="left" style="width: 300px"> 275 <asp:LinkButton id="<span" class="st">"LinkButton1" runat="server" CommandArgument='<%# Bind("Poll_Id") %>' 276 PostBackUrl="~/#Top" CommandName="SelectPoll"> 277 <asp:Label id="<span" class="st">"QuestionLabel" runat="server" Text='<%# Bind("Poll_Question") %>'></asp:Label> 278 </asp:LinkButton> 279 280"right"> 281 <asp:Label id="<span" class="st">"LblAgo" runat="server" Text='<%# Counttime(Eval("Polldate","{0}"))%>' /> 282 </asp:Label> 283285 294286 Posted By : 287 <asp:Label id="<span" class="st">"Labal" runat="server" Text='<%# Bind("Name") %>' /></asp:Label> 288 289"width: 4px"> 290 291"width: 4px"> 292 293295 304296 Total Votes : 297 <asp:Label id="<span" class="st">"Label2" runat="server" Text='<%# Bind("Total") %>' /> 298 </asp:Label> 299"width: 4px"> 300 301"width: 4px"> 302 303
306 307 308 <asp:TemplateField> 309 <ItemTemplate> 310 <asp:ImageButton id="<span" class="st">"ImageButton1" CommandName="CmdDeletePoll" CommandArgument='<%# Bind("Poll_Id") %>' 311 ImageUrl="~/images/1d.gif" runat="server" /> 312 <cc1:ConfirmButtonExtender id="<span" class="st">"ConfirmButtonExtender1" runat="server" ConfirmText="Are you sure ?" 313 TargetControlID="ImageButton1"> 314 </cc1:ConfirmButtonExtender> 315 </asp:ImageButton> 316 </ItemTemplate> 317 </asp:TemplateField> 318 <PagerStyle backcolor="<span" class="st">"Silver" ForeColor="White" HorizontalAlign="Center" /> 319 <HeaderStyle horizontalalign="<span" class="st">"Left" BackColor="#7F9DB9" /> 320 <EmptyDataRowStyle font-bold="<span" class="st">"False" Font-Size="Medium" ForeColor="Red" HorizontalAlign="Center" /> 321 <PagerSettings position="<span" class="st">"TopAndBottom" /> 322 </PagerSettings> 323 </EmptyDataRowStyle> 324 <Triggers> 325 <asp:AsyncPostBackTrigger controlid="<span" class="st">"btnUnVotedPollTrigger" /> 326 </asp:AsyncPostBackTrigger> 327 </Triggers> 328 </HeaderStyle> 329 </PagerStyle> 330 331 332 333 334 protected void btnMyPollTrigger_ServerClick(object sender, EventArgs e) 335 { 336 //relevant code 337 } 338 protected void btnVotedPollTrigger_ServerClick(object sender, EventArgs e) 339 { 340 //relevant code 341 } 342 protected void btnUnVotedPollTrigger_ServerClick(object sender, EventArgs e) 343 { 344 //relevant code 345 }Saturday, July 19, 2008 1:02 AM