Rambler's Top100
Главная
Новости
Статьи
Форумы
Книги
Коды
Сообщество
Блоги
О нас
 

Логин

Email:
  Пароль:

Войти
Зарегистрироваться
Забыл пароль

Поиск

 Искать :
 
Вперед

Сообщение

byeg


Молчун

Зарегистрирован:
21 October 2006
Сообщения: 29
Примеры кода: 0
 

Проблема с UpdatePanels

12 May 2008 11:23  


HTML code
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<%-- left upper zone --%>
<tr>
<td><asp:UpdatePanel id="helpUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False">
<ContentTemplate>
<DIV class="left3"><DIV style="MARGIN: 0px 11pt 0px 10pt; TEXT-ALIGN: center"><asp:SqlDataSource id="helpDataSource" runat="server" __designer:wfdid="w13" ConnectionString="<%$ ConnectionStrings:help4orphansConString %>" SelectCommand="SELECT [name], [lastname], [dob], [sex], [orphanage], [alias] FROM [children] WHERE ([availableForSponsoring] = @availableForSponsoring)"><SelectParameters>
<asp:Parameter DefaultValue="true" Name="availableForSponsoring" Type="Boolean"></asp:Parameter>
</SelectParameters>
</asp:SqlDataSource><asp:DetailsView id="helpDetailsView" runat="server" BorderStyle="None" Width="170px" Height="50px" __designer:wfdid="w14" HorizontalAlign="Center" OnItemCommand="helpDetailsView_ItemCommand" OnPreRender="helpDetailsView_PreRender" GridLines="None" DataSourceID="helpDataSource" AutoGenerateRows="False" AllowPaging="True">
<PagerSettings Visible="False"></PagerSettings>
<Fields>
<asp:TemplateField HeaderText="name" ShowHeader="False" SortExpression="name"><ItemTemplate>
<asp:Image id="imgHelpChild" runat="server"
ImageUrl='<%# this.ResolveUrl("~/" + string.Format("img/children/{0}.jpg", Eval("alias").ToString().Trim()))%>'
AlternateText='<%#Eval("name").ToString().Trim() %>'></asp:Image>
<p>Please help<br />
<strong><%#DataBinder.Eval(Container.DataItem, "name") %></strong><br />
<%# (DateTime.Now - Convert.ToDateTime(Eval("dob"))).Days / 365 %> years old
<%#(Eval("sex").ToString() == "m") ? "boy" : "girl"%> from<br />
<%#(Eval("orphanage").ToString() == "rbs") ? "the Regional Orphanage" : ""%><%#(Eval("orphanage").ToString() == "sho") ? "Shoptykolskiy Orphanage" : ""%></p>
<asp:ImageButton id="btnLearnMore" runat="server" ImageUrl="~/img/btnLearnMore.gif" CausesValidation="False" CommandName="learnMore" Enabled="False" ToolTip="This function is temporary disabled"></asp:ImageButton>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="alias" HeaderText="alias" ShowHeader="False" SortExpression="alias">
<ItemStyle Font-Size="1pt" ForeColor="#EFD79C"></ItemStyle>
</asp:BoundField>
</Fields>
</asp:DetailsView> <asp:Timer id="helpTimer" runat="server" __designer:dtid="562949953421331" __designer:wfdid="w15" EnableViewState="False" Interval="5000" OnTick="helpTimer_Tick"></asp:Timer> </DIV></DIV>
</ContentTemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID="helpTimer" EventName="Tick"></asp:AsyncPostBackTrigger>
</triggers>
</asp:UpdatePanel>
<div id="helpUpdateProgress"><asp:Image ID="helpProgress"
runat="server" ImageUrl="~/img/progress.gif" /><asp:Image
ID="helpProgress1" runat="server" ImageUrl="~/img/progress1.gif" /></div>
<ajaxToolkit:UpdatePanelAnimationExtender ID="helpUPAnimationExt"
runat="server" TargetControlID="helpUpdatePanel">
<Animations>
<OnUpdating>
<Parallel duration="0">
<FadeOut minimumOpacity=".5" />
<ScriptAction Script="onUpdating();" />
</Parallel>
</OnUpdating>
<OnUpdated>
<Parallel duration="0">
<FadeIn minimumOpacity=".5" />
<ScriptAction Script='onUpdated("helpUpdateProgress");' />
</Parallel>
</OnUpdated>
</Animations>
</ajaxToolkit:UpdatePanelAnimationExtender>
</td>
</tr>
<%-- left lower zone --%>
<tr>
<td id="left4">
<div style="width:219px;border-top:solid 1px #a5acb2;border-bottom:solid 1px #a5acb2">
<asp:Image ID="imgLeftHeaderGray" runat="server" ImageUrl="~/img/leftSiteNews.gif" />
<asp:UpdatePanel ID="newsUpdatePanel" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="False" EnableViewState="False">
<ContentTemplate>
<DIV style="MARGIN: 0px 9px 0px 10px"><asp:SqlDataSource id="newsDataSource" runat="server" __designer:wfdid="w24" ConnectionString="<%$ ConnectionStrings:help4orphansConString %>" SelectCommand="SELECT [date], [description], [link] FROM [pages] WHERE ([news] = @news) ORDER BY [date] DESC" EnableCaching="True"><SelectParameters>
<asp:Parameter DefaultValue="true" Name="news" Type="Boolean"></asp:Parameter>
</SelectParameters>
</asp:SqlDataSource> <asp:GridView id="newsGridView" runat="server" BorderStyle="None" Width="200px" __designer:wfdid="w25" GridLines="None" DataSourceID="newsDataSource" AllowPaging="True" ShowHeader="False" AutoGenerateColumns="False" PageSize="5">
<PagerSettings FirstPageText="" LastPageText="" Mode="NextPrevious" NextPageImageUrl="~/img/btnNext.gif" NextPageText="Next page" PreviousPageImageUrl="~/img/btnPrev.gif" PreviousPageText="Previous page"></PagerSettings>
<Columns>
<asp:TemplateField HeaderText="date" SortExpression="date"><EditItemTemplate>
<asp:TextBox runat="server" Text='<%# Bind("date") %>' id="TextBox1"></asp:TextBox>
</EditItemTemplate>
<ItemTemplate>
<p><asp:Label id="lblDate" runat="server" Font-Size="Smaller" Text='<%# Eval("date", "{0:MMMM d, yyyy}") %>' Font-Bold="True"></asp:Label><br /></p><div style="FONT-SIZE: 8pt"><asp:Label id="lblDescription" runat="server" Text='<%# Eval("description")%>'></asp:Label> <%#(Eval("link").ToString() == String.Empty) ? "" : "..."%><asp:HyperLink id="HyperLink1" runat="server" Text='<%#(Eval("link").ToString() == String.Empty) ? "" : "More"%>' NavigateUrl='<%# this.ResolveUrl("~/" + string.Format("articles.aspx?id={0}", Eval("link")))%>'>
</asp:HyperLink></div>
</ItemTemplate>
</asp:TemplateField>
</Columns>

<PagerStyle HorizontalAlign="Center"></PagerStyle>
<EmptyDataTemplate>
There is no news
</EmptyDataTemplate>
</asp:GridView></DIV>
</ContentTemplate>
<triggers>
<asp:AsyncPostBackTrigger ControlID="newsGridView" EventName="PageIndexChanged"></asp:AsyncPostBackTrigger>
</triggers>
</asp:UpdatePanel>
<div id="newsUpdateProgress">
<asp:Image ID="newsProgress" runat="server" ImageUrl="~/img/progress.gif" /><asp:Image
ID="newsProgress1" runat="server" ImageUrl="~/img/progress1.gif" /></div>
<ajaxToolkit:UpdatePanelAnimationExtender ID="newsUPAnimationExt" runat="server" TargetControlID="newsUpdatePanel">
<Animations>
<OnUpdating>
<Parallel duration="0">
<FadeOut minimumOpacity=".5" />
<ScriptAction Script="onUpdating1();" />
</Parallel>
</OnUpdating>
<OnUpdated>
<Parallel duration="0">
<FadeIn minimumOpacity=".5" />
<ScriptAction Script='onUpdated("newsUpdateProgress");' />
</Parallel>
</OnUpdated>
</Animations>
</ajaxToolkit:UpdatePanelAnimationExtender>
</div>
</td>
</tr>
<tr>
<td> <!-- bottom empty cell --></td>
</tr>
</table>


CS код
protected void helpTimer_Tick(object sender, EventArgs e)
    {
        Random nextHelp = new Random();
	    
	    helpDetailsView.PageIndex = 
		    nextHelp.Next(helpDetailsView.PageCount);
    }



Не думаю, что дело в JS фунциях которые вызываются при Update, но на всякий случай, вот их код
<script language="javascript" type="text/javascript">
function onUpdating(){
// get the update progress div
var updateProgressDiv = $get('helpUpdateProgress');
// make it visible
updateProgressDiv.style.display = 'block';

// get the gridview element
var up = $get('<%= this.helpUpdatePanel.ClientID %>');

// gt the bounds of both the gridview and the progressdiv
var upBounds = Sys.UI.DomElement.getBounds(up);
var updateProgressDivBounds = Sys.UI.DomElement.getBounds(updateProgressDiv);

// do the math to figure out the where to position the ProgressDiv
var y = upBounds.y + Math.round(upBounds.height / 3) -
Math.round(updateProgressDivBounds.height / 2);
var x = upBounds.x + Math.round(upBounds.width / 2) -
Math.round(updateProgressDivBounds.width / 2);

// set the ProgressDiv into this position
Sys.UI.DomElement.setLocation(updateProgressDiv, x, y);
}

function onUpdating1(){
// get the update progress div
var updateProgressDiv = $get('newsUpdateProgress');
// make it visible
updateProgressDiv.style.display = 'block';

// get the gridview element
var up = $get('<%= this.newsUpdatePanel.ClientID %>');

// gt the bounds of both the gridview and the progressdiv
var upBounds = Sys.UI.DomElement.getBounds(up);
var updateProgressDivBounds = Sys.UI.DomElement.getBounds(updateProgressDiv);

// do the math to figure out the where to position the ProgressDiv
var y = upBounds.y + Math.round(upBounds.height / 3) -
Math.round(updateProgressDivBounds.height / 2);
var x = upBounds.x + Math.round(upBounds.width / 2) -
Math.round(updateProgressDivBounds.width / 2);

// set the ProgressDiv into this position
Sys.UI.DomElement.setLocation(updateProgressDiv, x, y);
}

function onUpdated(updateProgressName) {
// get the ProgressDiv
var updateProgressDiv = $get(updateProgressName);
// make it invisible
updateProgressDiv.style.display = 'none';
}
</script>


Данное сообщение получено с сайта GotDotNet.RU
Наверх
  



Общие вопросы программирования на ASP.NET

 Проблема с UpdatePanelsbyeg  12 May 2008 08:27
 Проблема с UpdatePanelsrazon  12 May 2008 08:57
 Проблема с UpdatePanelsbyeg  12 May 2008 10:03
 Проблема с UpdatePanelsrazon  12 May 2008 10:06
 Проблема с UpdatePanelsbyeg  12 May 2008 11:23
 Проблема с UpdatePanelsrazon  12 May 2008 15:03
 Проблема с UpdatePanelsbyeg  12 May 2008 16:36
 Проблема с UpdatePanelsbyeg  12 May 2008 17:13
 Проблема с UpdatePanelsrazon  12 May 2008 19:49
 
Наш Киев

Apartments for Rent

Rambler's Top100
Рейтинг@Mail.ru
Идея: Dimon aka Manowar Программирование: Dimon aka Manowar Дизайн: Dan Lebedev
Хостинг от компании Parking.ru
Карта сайта