Load from database without load whole page

T

tranky

Hi!
I'd like to insert a new ajax.net idea inside my homepage.
I'd like to realize this, and i hope you can help me. (i'm italian,
excuse me for my english!!)
In my homepage, i load last 15 messages from my forum (via mysql
database). These messages are loaded with title and body and show with
an ajax.net accordion
I'd like to load only last 15 titles and load the body only when user
click over title. This message will show below title and will hide if
user re-click over title.
Obviously, i'll load body from database using updatepanel, so, not all
page will be reload but only that, showing to the user that a loading is
in progress.

I hope you can help me.
I need it!! :)
Thank u so much!
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,

I fail to see where the question is.
You can use a popup extender, so when the user click the title the message
is displayed below it.

Here is an example of how to use it. Well, I will give you two examples, in
the first the message is rendered always and is not visible.
<asp:Label runat="Server" ID="IdLabel"
CssClass="MoreDetailsLblStyle" Text='<%#Eval("Id") %>'></asp:Label>
<cc1:HoverMenuExtender
ID="PopupControlExtender1" PopupPosition="bottom" TargetControlID="IdLabel"
PopupControlID="BatchDetailPNL"
runat="server">
</cc1:HoverMenuExtender >
<asp:panel ID="BatchDetailPNL" runat="server"
CssClass="HiddenPanel" style="display:none">
<div class='DynaPanel'>
Ran by:
<span >
<%# Eval("run_by")%>
</span>
&nbsp;&nbsp;At:
<span >
<%#Convert.ToDateTime(Eval("run_datetime")).ToShortTimeString()%>
</span>
<br />
Comments:<br />
<span><%# Eval("Comment") %></span>
</div>
</asp:panel>

In this one I create the Panel content dynamically:

<asp:Label runat="server" ID="ShowDetailsLBL1"
CssClass="MoreDetailsLblStyle">More Details</asp:Label>
<cc1:popupControlExtender
ID="PopupControlExtender1" runat="server" TargetControlID="ShowDetailsLBL1"
PopupControlID="MoreDetailsPNL"
DynamicControlID="MoreDetailsPNL" DynamicContextKey='<%# Eval("AgencyId")
%>'
Position="Bottom"
DynamicServiceMethod="GetDynamicContent">
</cc1:popupControlExtender>

<asp:panel ID="MoreDetailsPNL" runat="server"
CssClass="HiddenPanel">
</asp:panel>



[System.Web.Services.WebMethodAttribute(),
System.Web.Script.Services.ScriptMethodAttribute()]
public static string GetDynamicContent(string contextKey)
{

StringBuilder sb = new StringBuilder();
int agentID = Convert.ToInt32(contextKey);
Agent agent = new Agent(agentID);
sb.Append("<div class='DynaPanel'><table class='DynaPanel'>");
if (agent.AgentNumber != null)
{
sb.Append("<tr><td align='right'>");
sb.Append("Agent Number:</td>");
sb.Append("<td>");
sb.Append(agent.AgentNumber);
sb.Append("</td></tr>");
}

}
sb.Append("</table></div>");
........
return sb.ToString();
}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top