Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Wednesday, March 28, 2012

Dynamic Collapsible Panels - Flicker and slow load

Hello,

I have a User Control that dynamically creates several collapsible panels depending on records read from sql db. The panels are created okay, but the page loads slow and flickers several times. It partially loads, displays first panel very quickly and goes blank until all other panels are created and data is loaded. It looks awfull!!

Is there a way to improve the UI?, so the page shows all panels when loaded. It would be good also showing a "wait for a moment" message when creating many panels. What is the best way to do it?

Thank you,

Carlos Lozano

Any one?

Any comments would be helpfull. Thank you.Carlos


I can't help with your issues, but could you show me how you create dynamic panels based on SQL data? Once I get it working, I will discuss with others around here to determine if there is a solution.


Mine works without the flickering. I don't use a code behind in the control that buildds it.


Try to set in web.config <compilation debug="false">

It will improve some performance.


Below is the main code that creates the panel.

Notes:

1) CustomPanel is a customization of Panel class.

2) sNewEndingID is a counter to identify each panel and its controls.

3) TableUtil.AddTableRow function basically adds the <tr><td>controls here</td></tr> to the panel to organize the panel presentation.

4) oOptions.getOptionData("Inspection") Pulls data from SQL DB to populate some of the control options (ie. DropdownList, etc).

-- Code --

public void createInspectorPanel(ref CustomPanel oParentPanel, string sNewEndingID)
{
OptionsObject oOptions = new OptionsObject();
//oParentPanel.Visible = false;

AjaxControlToolkit.CollapsiblePanelExtender oExPanel = new AjaxControlToolkit.CollapsiblePanelExtender();
CustomPanel oPanel = new CustomPanel();
oPanel.ID = "InspectorItem" + sNewEndingID;
if (oParentPanel.Controls.IndexOf(oPanel) == -1)
{
oExPanel.ID = "InspectorPanelExtender" + sNewEndingID;
oExPanel.TargetControlID = "InspectorPanel" + sNewEndingID;
oExPanel.ExpandControlID = "InspectorPanelHeader" + sNewEndingID;
oExPanel.CollapseControlID = "InspectorPanelHeader" + sNewEndingID;
oExPanel.Collapsed = true;
oExPanel.TextLabelID = "lblInspectorControlText" + sNewEndingID;
oExPanel.CollapsedText = sNewEndingID + ") - Click to view details ";
oExPanel.ExpandedText = sNewEndingID + ") - Click to hide details ";
oExPanel.SuppressPostBack = false;
oPanel.Controls.Add(oExPanel);

CustomPanel oPanelHeader = new CustomPanel();
oPanelHeader.ID = "InspectorPanelHeader" + sNewEndingID;
oPanelHeader.CssClass = "collapsePanelHeader";
//oPanelHeader.Width = 300;
oPanelHeader.Width = Unit.Percentage(98);

Label oCounterLabel = new Label();
oCounterLabel.ID = "lblInspectorCounter" + sNewEndingID;
oPanelHeader.Controls.Add(oCounterLabel);

Label oControlLabel = new Label();
oControlLabel.ID = "lblInspectorControlText" + sNewEndingID;
oControlLabel.CssClass = "BTextClass";
oPanelHeader.Controls.Add(oControlLabel);
oPanel.Controls.Add(oPanelHeader);

CustomPanel oDetailPanel = new CustomPanel();
oDetailPanel.ID = "InspectorPanel" + sNewEndingID;
oDetailPanel.Height = 50;
//oDetailPanel.Width = 350;
oDetailPanel.Width = Unit.Percentage(98);

HtmlTable oTable = new HtmlTable();
TableUtil.AddTableRow(ref oTable, 1, "InspectorName", "Name: ", 1, sNewEndingID);
TableUtil.AddTableRow(ref oTable, 2, "CompanyName", "Company: ", 1, sNewEndingID);
DropDownList MPICertLevel = new DropDownList();
TableUtil.AddTableRow(ref oTable, ref MPICertLevel, ";1;2;3", "MPICertLevel", "MPI Cert. Level: ", sNewEndingID);
DropDownList LPCertLevel = new DropDownList();
TableUtil.AddTableRow(ref oTable, ref LPCertLevel, ";1;2;3", "LPCertLevel", "LP Cert. Level: ", sNewEndingID);
DropDownList EMICertLevel = new DropDownList();
TableUtil.AddTableRow(ref oTable, ref EMICertLevel, ";1;2;3", "EMICertLevel", "EMI Cert. Level: ", sNewEndingID);
DropDownList UTCertLevel = new DropDownList();
TableUtil.AddTableRow(ref oTable, ref UTCertLevel, ";1;2;3", "UTCertLevel", "UT Cert. Level: ", sNewEndingID);
//DropDownList Inspection = new DropDownList();
ListBox Inspection = new ListBox();
Inspection.DataTextField = "Description";
Inspection.DataValueField = "Id";
Inspection.DataSource = oOptions.getOptionData("Inspection");
Inspection.Rows = 6;
Inspection.SelectionMode = ListSelectionMode.Multiple;
Inspection.DataBind();
TableUtil.AddTableRow(ref oTable, ref Inspection, "Inspection", "Inspections Done: ", sNewEndingID);
DropDownList TxtPerformance = new DropDownList();
TxtPerformance.DataTextField = "Description";
TxtPerformance.DataValueField = "Id";
TxtPerformance.DataSource = oOptions.getOptionData("InspPerformance");
TxtPerformance.DataBind();
TableUtil.AddTableRow(ref oTable, ref TxtPerformance, "Performance", "Performance: ", sNewEndingID);
TableUtil.AddTableRow(ref oTable, 9, "InspDiscrepancies", "Discrepancies: ", 2, sNewEndingID, 40);

oDetailPanel.Controls.Add(oTable);
oPanel.Controls.Add(oDetailPanel);
oParentPanel.Controls.Add(oPanel);
//oParentPanel.Visible = true;
}
}


Did you set your Content Panel's height to 0px. I'm not sure if I'm reading this correctly but I seeoDetailPanel.Height = 50;Maybe try setting that to 0 and see if that helps with the flickering.

dynamic cascaded drop down

Hi..

well in my web page based on a parameter user selects i need to create contents dynamically

for eg if A is passed than page will have only 1 drop down but if B is passed it might have 7 8 drop downs in it..

this is one part of the problem..once i am able to create them i need to address there selection index change even which will call again some fucntion

which will reload all othr drop dwon whch were created dynamically

so its kind of generating cascaded drop down dynamically and the parent control id could be more than one

Can some one help me out

in case any one is here wondering what happened to the problem

the solution is same as

http://forums.asp.net/t/1090354.aspx

dynamic AnimationExtender

I have a list of users in a database and I want to return the list of users to an aspx page with a user icon. I then want to have an ajaxToolkit:AnimationExtender attached to each icon. I have the ajaxToolkit:AnimationExtender working for a single image on a page with all of the script code in the markup. How do I at runtime set a ajaxToolkit:AnimationExtender for each icon.

Thanks

OK,

I have been playing with the toolkit sample code to try and make it OO to some degree. Here is what I have:

3 functions

1 to make the flyout panel,1 to make the onclick open animation and 1 to make the onclick close animation.

I can make the the first to work but I am having trouble with the last one becuase the sample code uses a asp:linkbutton to close the animation. When I try and build it from code/html it is not being converted into a control and the close animation can't find it's targetcontrol id.

here is the flyout panel:

publicstring BuildAnimationPopup(string inPopUpHTML ,outstring flyout,outstring info,outstring btnCloseParent,outstring close)

{

System.Text.StringBuilder sb =new System.Text.StringBuilder();

flyout ="flyout" +DateTime.Now.Millisecond.ToString(); //just to make it unique

info ="info" +DateTime.Now.Millisecond.ToString(); //just to make it unique

btnCloseParent ="btnCloseParent" +DateTime.Now.Millisecond.ToString(); //just to make it unique

close ="btnClose" +DateTime.Now.Millisecond.ToString(); //just to make it unique

//<!-- "Wire frame" div used to transition from the button to the info panel -->

sb.Append("<div id='"+ flyout +"' style='display: none; overflow: hidden; z-index: 2; background-color: #FFFFFF; border: solid 1px #D0D0D0;'></div>");

//<!-- Info panel to be displayed as a flyout when the button is clicked -->

sb.Append("<div id='"+info+"' style='display: none; ; z-index: 2; opacity: 0; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0); font-size: 12px; border: solid 1px #CCCCCC; background-color: #FFFFFF; padding: 5px;'>");

sb.Append("<div id='"+btnCloseParent+"' style='float: right; opacity: 0; filter: progid:DXImageTransform.Microsoft.Alpha(opacity=0);'>");

//sb.Append("<asp:LinkButton id='"+close +"' runat='server' OnClientClick='return false;' Text='X' ToolTip='Close' Style='background-color: #666666; color: #FFFFFF; text-align: center; font-weight: bold; text-decoration: none; border: outset thin #FFFFFF; padding: 5px;' />");

sb.Append("<a onclick='return false;' runat='server' id='"+close+"' title='Close' style='background-color: #666666; color: #FFFFFF; text-align: center; font-weight: bold; text-decoration: none; border: outset thin #FFFFFF; padding: 5px;'>X</a>");

sb.Append("</div>");

sb.Append("<div>");

sb.Append(inPopUpHTML);

sb.Append("</div>");

sb.Append("</div>");

return sb.ToString();

}

As you can see I have tried it both ways, using an asp:linkbutton and a plain old <a> with the runat=server tag but the Ajax control still can't find it.

Any thoughts?

Monday, March 26, 2012

Dynamic Ajax Content rendering in a div tag

Hi All,

I had a requirement like, where i will do asynchrounous get of data, and load the data say 10 records in a div tag. if user scroll through the div and reaches teh end of the div tag, i will remove all conents from div and load fresh contents from 11-20 in div. Like this it goes...

Now my problem,

Step 1:- 1-10 records show in div (now user scroll to end of div)

Step 2:- Remove 1-10 records show 11-20 records in div. My Question is if user wants to see 1-10 records back, i am not able to take the user to the top since the first record is at the top of the div. I can't fire any event here.

Can anyone help on this?

Thanks in advance,

Karthikeyan.

Can you poste some code? I get the idea but I want to see what even handler you are using to track the scrolling in conjunction with the records being scrolled. Perhaps also you might want to use hidden fields that put the value of the previous set of pages (in your case 1-10).


Hi,

Thank you for your post!

I suggest you keep 20 records in the div, and just display half of them.

Then, when you want get the pre 10 records, just do it like you get the next 10 Records because you can fire some events of the scroll.

If you have further questions,let me know.

Best Regards,

Dynacly add scriptmanager when needed?

Hi,

I'm trying to create a Web User Control that uses asp.net Ajax. I'd like it to find out if a scriptmanager already exists in the page and, if not, add ti dynamically. Would such a thing be possible?


Thanks in advance for any help.


Regards,

Stefan

Yes its possible, you can check if ScriptManager is registered. FindControl(); or you can added it in the Master Page

http://forums.asp.net/thread/1441992.aspx

http://forums.asp.net/thread/1436775.aspx


Thanks for your quick reply. But how would I use FindControl if I don't know what the name of the scriptmanager would be?

I'm thinking of a situation where my control gets used in combination with other ajax controls, or gets used multpile times on a form. (Actually, my control would be a DotNetNuke module)

Any ideas?


If you didn't change it ScriptManager1


I know, but the hard thing is, that all controls get added to the page dynamically by DotNetNuke. This means I'm pretty sure the name won't be ScriptManager1...

So if there's no other way than to use findcontrol, the only option would be to add the ScripManager to the page itself somehow.


Thanks for your help.



hello.

you can get a reference to the ScriptManager control by using the static GetCurret method. If there's already a ScriptManager on the page, you will get a non null value.

I've put together an example ofUsing Control Adapters to automatically attach AJAX Extenders to ASP.NET Controls, which isn't exactly what you want, but there is code for walking through the controls on a page to see if there is already a ScriptManager or ScriptManagerProxy ...

http://damianblog.com/2006/11/16/adapters-and-extenders/

Damian


hello.

hum...why are you going through a cicle to get the scriptmanager control?


Because I'm doing it from an HttpModule ... and also because I didn't know of the static method :-)

Not sure if it will work in the module though ... will have a go.

Damian


hello.

well, i guess it might not work if you haven't instantiated the master page (which is easily solved by just "touching" the property)


Hi again, it's been a while since I had time to figure this thing out, but your answers look promising. Thanks a lot so far.

Dyanimc TextBoxWatermark in GridView Pager Template

I have a textbox in my gridview pager template to allow the user to enter a page number to jump to. I would like the watermark to read Page X of Y. I tried to set the watermark text on the GridView_DataBound event, but that doesn't work.

My guess is this occurs because most (if not all) AJAX controls render client scripts durning the preload event and the databound event executes long after the preload. Is this correct? Is this by design? Will AJAX controls always render in the preload event?

Is there a workaround I could use to generate thePage X of Y for the watermark via javascript or something?

Thank you for your assistance

This should work - have a look at the DataBinding.aspx page in the ToolkitTests directory for an example. If you're still stuck, please post a complete, self-contained sample demonstrating the issue. Thanks!

DummyHtmlTextWriter Exception

Hi All,

I am getting the following exception using the April CTP:

System.Exception was unhandled by user code Message="An instance of 'Microsoft.Web.UI.DummyHtmlTextWriter' could not be used as an HtmlTextWriter. Make sure the specified class can be instantiated, extends System.Web.UI.HtmlTextWriter, and implements a constructor with a single parameter of type System.IO.TextWriter." Source="App_Web_sqmaviya" StackTrace: at Forms_Coordinators_AwardPoints.scriptManager_PageError(Object sender, PageErrorEventArgs e)in c:\Documents and Settings\jyoung\My Documents\Visual Studio 2005\WebSites\Pointfolio_v2\Forms\Coordinators\AwardPoints.aspx.cs:line 188 at Microsoft.Web.UI.ScriptManager.OnPageError(PageErrorEventArgs e) at Microsoft.Web.UI.ScriptManager.OnPageError(Exception ex) at Microsoft.Web.UI.ScriptManager.RenderPageCallback(HtmlTextWriter writer, Control pageControl) at System.Web.UI.Control.RenderChildrenInternal(HtmlTextWriter writer, ICollection children) at System.Web.UI.Control.RenderChildren(HtmlTextWriter writer) at System.Web.UI.Control.Render(HtmlTextWriter writer) at System.Web.UI.Page.Render(HtmlTextWriter writer) at System.Web.UI.Control.RenderControlInternal(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer, ControlAdapter adapter) at System.Web.UI.Control.RenderControl(HtmlTextWriter writer) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
This has proven to be very difficult to replicate as it seems completely random.
I have a web user control that contains a TreeView and 2 GridViews (available and selected).
Think file explorer with folders in the tree, files in one gridview and files that have been selected (via available) in the second gridview.
Both gridviews are wrapped in updatepanels with available triggering off the treeview and the selected triggering off the command of available.
The above exception gets thrown at random points when the triggers are fired.
I say random, because I can replicate the error, but not in an orderly fashion.
I go through selecting and deselecting and everything works fine and then boom exception.
Any help or insight would be greatly appreciated.

I tried the June CTP with the same issues.


In the hopes that this was an issue with the local dev server that is built into VS, I tried this under IIS6 with the same exception.

I am growing very discouraged by this. I ditched a custom built AJAX implementation in favor of Atlas and am now thinking that I have to ditch Atlas and go back to my implementation. I REALLY REALLY don't want to do this, but I don't know how to get around the exception.

I tried swallowing the exception but then I can an "Unknown Error" alert and then the whole thing blows up.

The aspx markup and codebehind is a bit long, but I can post it if you think it will help.

If this is an exception that I can do nothing about, is there anyway to swallow it and have it keep working without having to refresh the page?

I could really use the help on this one.

Thanks,

Joe


Hi,

two questions:

1) are you handling the PageError event of the ScriptManager?
2) are you using cache?

Hi, I am using the PageErrorEvent

protected void scriptManager_PageError(object sender, Microsoft.Web.UI.PageErrorEventArgs e) {throw new Exception(e.ErrorMessage); }
There is no caching at this page. There is some cache use in other parts of the application.

I take it there is some issue between Atlas and Output Caching and if we use one we can't use the other? What are the issues? Can you point me to a resource where there is more information?


I created a test project and was able to replicate the error.
It seems to have to due something with output caching. I added a webusercontrol and enabled output caching on it and got the error.
I can't upload my test solution so I will show all the code.

Web.Config
<configuration>
<!--
The configSections define a section for ASP.NET Atlas.
-->
<configSections>
<sectionGroup name="microsoft.web" type="Microsoft.Web.Configuration.MicrosoftWebSectionGroup">
<section name="converters" type="Microsoft.Web.Configuration.ConvertersSection" />
<section name="webServices" type="Microsoft.Web.Configuration.WebServicesSection" />
<section name="authenticationService" type="Microsoft.Web.Configuration.AuthenticationServiceSection" />
<section name="profileService" type="Microsoft.Web.Configuration.ProfileServiceSection" />
</sectionGroup>
</configSections
<!--
The microsoft.web section defines items required for the Atlas framework.
-->
<microsoft.web>
<converters>
<add type="Microsoft.Web.Script.Serialization.Converters.DataSetConverter"/>
<add type="Microsoft.Web.Script.Serialization.Converters.DataRowConverter"/>
<add type="Microsoft.Web.Script.Serialization.Converters.DataTableConverter"/>
</converters>
<webServices enableBrowserAccess="true" />
</microsoft.web>

<appSettings/>
<connectionStrings/>

<system.web>
<pages>
<controls>
<add namespace="Microsoft.Web.UI" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
<add namespace="Microsoft.Web.UI.Controls" assembly="Microsoft.Web.Atlas" tagPrefix="atlas"/>
</controls>
</pages>
<compilation debug="false">
<buildProviders>
<add extension=".asbx" type="Microsoft.Web.Services.BridgeBuildProvider" />
</buildProviders>
</compilation>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
<!--
The MultiRequestHandler enables multiple requests to be handled in one
roundtrip to the server. Its use requires Full Trust.
-->
<add verb="*" path="atlasbatchcall.axd" type="Microsoft.Web.Services.MultiRequestHandler" validate="false"/>
<add verb="*" path="atlasglob.axd" type="Microsoft.Web.Globalization.GlobalizationHandler" validate="false"/>
<!--
The IFrameHandler enables a limited form of cross-domain calls to 'Atlas' web services.
This should only be enabled if you need this functionality and you're willing to expose
the data publicly on the Internet.
To use it, you will also need to add the attribute [WebOperation(true, ResponseFormatMode.Json, true)]
on the methods that you want to be called cross-domain.
This attribute is by default on any DataService's GetData method.

<add verb="*" path="iframecall.axd" type="Microsoft.Web.Services.IFrameHandler" validate="false"/>
-->
<add verb="*" path="*.asbx" type="Microsoft.Web.Services.ScriptHandlerFactory" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="Microsoft.Web.Services.ScriptModule"/>
<add name="BridgeModule" type="Microsoft.Web.Services.BridgeModule"/>
<add name="WebResourceCompression" type="Microsoft.Web.Services.WebResourceCompressionModule"/>
</httpModules>
<authentication mode="Windows" />
</system.web>
</configuration>

ASPX Page
<%@. Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="AtlasTest._Default" %
<%@. register src="http://pics.10026.com/?src=WebUserControl1.ascx" tagname="WebUserControl1" tagprefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<atlas:scriptmanager id="scriptManager" runat="server" enablepartialrendering="true" onpageerror="scriptManager_PageError"></atlas:scriptmanager>
<asp:treeview id="TreeView1" runat="server" onselectednodechanged="TreeView1_SelectedNodeChanged">
</asp:treeview>
<atlas:updatepanel id="updatePanel1" runat="server" mode="Conditional">
<contenttemplate>
<asp:gridview id="GridView1" runat="server" backcolor="White" bordercolor="#CC9966" borderstyle="None" borderwidth="1px" cellpadding="4" autogeneratecolumns="False" autogenerateselectbutton="True" onselectedindexchanged="GridView1_SelectedIndexChanged">
<footerstyle backcolor="#FFFFCC" forecolor="#330099" />
<rowstyle backcolor="White" forecolor="#330099" />
<selectedrowstyle backcolor="#FFCC66" font-bold="True" forecolor="#663399" />
<pagerstyle backcolor="#FFFFCC" forecolor="#330099" horizontalalign="Center" />
<headerstyle backcolor="#990000" font-bold="True" forecolor="#FFFFCC" />
<columns>
<asp:boundfield headertext="Id" datafield="Id" />
<asp:boundfield headertext="Name" datafield="Name" />
</columns>
</asp:gridview>
</contenttemplate>
<triggers>
<atlas:controleventtrigger controlid="TreeView1" eventname="SelectedNodeChanged" /></triggers>
</atlas:updatepanel>
</div>
<uc1:webusercontrol1 id="WebUserControl1_1" runat="server" />
</form>
</body>
</html>

Code Behind
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace AtlasTest
{
public partialclass _Default : System.Web.UI.Page
{
private Dictionary<int, Group> groupDictionary;

protected void Page_Load(object sender, EventArgs e)
{
CreateGroups();

if (!Page.IsPostBack)
{
BindGroupTree(groupDictionary[1],null);
}
}

private void CreateGroups()
{

groupDictionary =new Dictionary<int, Group>();

Group root =new Group(1,"Root");
Group child1 =new Group(2,"Child1");
Group child2 =new Group(3,"Child2");
Group child11 =new Group(4,"Child11");
Group child12 =new Group(5,"Child12");
Group child21 =new Group(6,"Child21");
Group child22 =new Group(7,"Child22");

groupDictionary.Add(root.Id, root);
groupDictionary.Add(child1.Id, child1);
groupDictionary.Add(child2.Id, child2);
groupDictionary.Add(child11.Id, child11);
groupDictionary.Add(child12.Id, child12);
groupDictionary.Add(child21.Id, child21);
groupDictionary.Add(child22.Id, child22);

// Build the tree
root.Children.Add(child1.Id, child1);
root.Children.Add(child2.Id, child2);

child1.Children.Add(child11.Id, child11);
child1.Children.Add(child12.Id, child12);

child2.Children.Add(child21.Id, child21);
child2.Children.Add(child22.Id, child22);

child1.Users.Add(new User(11,"Test 11"));
child1.Users.Add(new User(12,"Test 12"));
child1.Users.Add(new User(13,"Test 13"));
child1.Users.Add(new User(14,"Test 14"));
child1.Users.Add(new User(15,"Test 15"));

child2.Users.Add(new User(21,"Test 21"));
child2.Users.Add(new User(22,"Test 22"));
child2.Users.Add(new User(23,"Test 23"));
child2.Users.Add(new User(24,"Test 24"));
child2.Users.Add(new User(25,"Test 25"));

child11.Users.Add(new User(111,"Test 111"));
child11.Users.Add(new User(112,"Test 112"));
child11.Users.Add(new User(113,"Test 113"));
child11.Users.Add(new User(114,"Test 114"));
child11.Users.Add(new User(115,"Test 115"));

child12.Users.Add(new User(121,"Test 121"));
child12.Users.Add(new User(122,"Test 122"));
child12.Users.Add(new User(123,"Test 123"));
child12.Users.Add(new User(124,"Test 124"));
child12.Users.Add(new User(125,"Test 125"));

child21.Users.Add(new User(211,"Test 211"));
child21.Users.Add(new User(212,"Test 212"));
child21.Users.Add(new User(213,"Test 213"));
child21.Users.Add(new User(214,"Test 214"));
child21.Users.Add(new User(215,"Test 215"));

child22.Users.Add(new User(221,"Test 221"));
child22.Users.Add(new User(222,"Test 222"));
child22.Users.Add(new User(223,"Test 223"));
child22.Users.Add(new User(224,"Test 224"));
child22.Users.Add(new User(225,"Test 225"));
}

private void BindGroupTree(Group group, TreeNode parent)
{
if (group.Children ==null) {return; }

foreach (KeyValuePair<int, Group> kvpin group.Children)
{
TreeNode treeNode =new TreeNode();
treeNode.Value = kvp.Key.ToString();
treeNode.Text = kvp.Value.Name;

if (parent ==null)
{
TreeView1.Nodes.Add(treeNode);
}
else
{
parent.ChildNodes.Add(treeNode);
}

BindGroupTree(kvp.Value, treeNode);
}
}

protected void TreeView1_SelectedNodeChanged(object sender, EventArgs e)
{
int selectedIndex = System.Convert.ToInt32(TreeView1.SelectedValue);

List users = groupDictionary[selectedIndex].Users;

GridView1.DataSource = users;
GridView1.DataBind();
}

protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
{

}

protected void scriptManager_PageError(object sender, Microsoft.Web.UI.PageErrorEventArgs e)
{
throw new Exception(e.ErrorMessage);
}
}
}

Data
using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace AtlasTest
{
public class Group
{
private int id;
private string name;
private Dictionary<int, Group> children;
private List users;

public int Id
{
get {return this.id; }
set {this.id =value; }
}

public string Name
{
get {return this.name; }
set {this.name =value; }
}

public Dictionary<int, Group> Children
{
get {return this.children; }
}

public List Users
{
get {return this.users; }
}

public Group(int id,string name)
{
this.id = id;
this.name = name;
this.children =new Dictionary<int, Group>();
this.users =new List();
}
}

public class User
{
private int id;
private string name;

public int Id
{
get {return this.id; }
set {this.id =value; }
}

public string Name
{
get {return this.name; }
set {this.name =value; }
}

public User(int id,string name)
{
this.id = id;
this.name = name;
}
}
}

WebUserControl
<%@. Control Language="C#" AutoEventWireup="true" CodeBehind="WebUserControl1.ascx.cs" Inherits="AtlasTest.WebUserControl1" %>
<%@. outputcache duration="5" varybyparam="none" %>
<asp:datalist id="DataList1" runat="server" onitemdatabound="DataList1_ItemDataBound">
<itemtemplate>
<asp:label id="lblTest" runat="server" text="Label"></asp:label>
</itemtemplate>
</asp:datalist>

WebUserControl CodeBehind
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace AtlasTest
{
public partialclass WebUserControl1 : System.Web.UI.UserControl
{
protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
BindData();
}
}

private void BindData()
{
List<string> testList =new List<string>();
testList.Add("One");
testList.Add("Two");
testList.Add("Three");
testList.Add("Four");
testList.Add("Five");

DataList1.DataSource = testList;
DataList1.DataBind();
}

protected void DataList1_ItemDataBound(object sender, DataListItemEventArgs e)
{
if ((e.Item.ItemType == ListItemType.Item) || (e.Item.ItemType == ListItemType.AlternatingItem))
{
string test = e.Item.DataItemas string;

Label lblTest = e.Item.FindControl("lblTest")as Label;

lblTest.Text = test;
}
}
}
}

It seems like there are some severe issues with Atlas and Caching. Is the Atlas team aware of this? If so is there a fix coming soon or a work around?

Thanks,

Joe


Hi,

is there any user control with cache enabled, in your page? What I suggest is, if you have user controls in your page, to remove each one and see if the problem persists. Specifically, look for controls or user controls that are *outside* an UpdatePanel.

Yeah, there was one usercontrol that used cache. It happens to be the only place where caching is used. I disabled the cache and have yet to encounter the exception. Is there a way to use both atlas and caching that I am not aware of? Is this behavior expected to be fixed in the final release. I will keep caching disabled for the time being as we cannot have random exceptions being thrown about,Big Smile but I would really like to use both.

Joe


Hi,

yes, there is an issue with the UpdatePanel and Output caching, at least in the April CTP:

http://forums.asp.net/thread/1318184.aspx

I don't know if it has been fixed in the current CTP (June), you can try to switch to the June CTP and see if it works, otherwise I'll do a test later. Let me know how it goes.

Thanks for the post about the issue, i have been looking everywhere (or so I thought) trying to find some more info.

I updated to the June CTP hoping that it was indeed fixed, but the same exception is still being thrown. I did not see error being fixed in the release notes as well, so I am assuming that it is not fixed. Hopefully it will be soon.Big Smile

Really appreciate the help and info.

Many Thanks,

Joe


I'm also encountering the same issue with the July CTP. I'm just hoping this will be fixed in whatever the next release is, as output caching is such a huge performance benefit.

Mark

DropShadowExtender problem

Hi

I am trying to place a DropShadowExtender for an asp:panel which is bound with HoverMenuExtender. So if the user hovers over a link, the panel will show up and drops a shadow. But the problem is the shadow is always showing up and when a user hovers away from the link the hovermenu dissapers but shadow remains there. Anyone knows a solution?

Thanks.

Hi Zeeshan,

I would recommend adding anotherPaneland have the DropShadowExtender point to the old one and theHoverMenuExtender point to the new one. If your currentPanel has the IDMyPanel, then you would want something that looked like this:

<asp:Panel id="WrapperPanel" runat="server" ... >
<asp:Panel id="MyPanel" runat="server" ... >
...
</asp:Panel>
</asp:Panel>
<atlasToolkit:DropShadowExtender ID="dse" runat="server">
<atlasToolkit:DropShadowProperties TargetControlID="MyPanel" ... />
</atlasToolkit:DropShadowExtender>
<atlasToolkit:HoverMenuExtender ID="hme" runat="Server">
<atlasToolkit:HoverMenuProperties PopupControlID="WrapperPanel" ... />
</atlasToolkit:HoverMenuExtender>

Thanks,
Ted


Thank you so much Ted. I was wondering if I can have fade in/out effect on my HoverMenuExtender. I tried doing it with scripts on my page but it doesn't work as the panel is under control of the extender so the effect doesn't show up. Anyone knows any other way around?

Thanks


Hi Zeeshan,

Right now the only way to change the visual effects for any of the controls is to change the script. This is even more complicated forHoverMenuBehavior.js because you'll notice that it uses theSys.UI.HoverBehavior andSys.UI.PopupBehavior classes defined by "Atlas".

Thanks,
Ted

Saturday, March 24, 2012

DropShadow Extender

Hi everybody,

I have noticed a problem with this control: when it runs on a page, if the user resize the window browser the control moves to fit to the new size, but the shadow doesn't. It happen this to you too ?

Consider setting TrackPosition="true" for the DropShadowExtender.
Thanks Davis, now it works fine.
Thanks David, now it works fine.

DropdownList OnSelectedIndexChanged event within ModalPopupExtender

I have aModalPopupExtender with two DropdownLists. I want to populate the second dropdownlist dynamically base on the user selection in the first dropdownlist. Once user selects values from both dropdown lists, then I want to postback the entire page.

But the OnSelectedIndexChanged event of the dropdownlist is not firing whenever the selection is changed.

Is this possible withinModalPopupExtender? Appreciate your help.

You may want AutoPostBack="true" and an UpdatePanel.

DropDownList inside UpdatePanel not posting back

I have a DropDownList inside a UpdatePanel (inside a user control) declared like so:  
<asp:UpdatePanelID="UpdatePanel_DropDownList_Accounts"runat="server"> <ContentTemplate> <asp:DropDownListID="DropDownList_Accounts"runat="server"AutoPostBack="true" OnSelectedIndexChanged="DropDownList_Accounts_SelectedIndexChanged"> </asp:DropDownList> </ContentTemplate></asp:UpdatePanel>

The user control is rendered in a Sharepoint (WSS 3.0) page. The first time I select an item from the list,

a postback occurs and the event handler is called. Every time after that, however, there is no postback.

I believe the problem to be related to the UpdatePanel control as the DropDownList behaves as expected

(posting back to the server every time a new item is selected) when not embedded in an UpdatePanel.

Any help or suggestions anyone could offer me to solve this problem would be appreciated.

Hello Seedstorm,

I think you have to register the DropDownlist to do a Postback in the Page_Init of your Control. There you have to find the ScriptManager of the page that holds the control and do the registration like that (pseudocode)

protected void Page_Init() {

(Parent.FindControl("myScriptMgr") as ScriptManager).RegisterPostBackControl( myDropDownCtrl );

}

I hope this helps you!


Hi CodeGod,

Thank you for replying. I did as you suggested. I registered the DropDownList using both the RegisterPostBackControl and RegisterAsyncPostBackControl methods.

After registering the control using RegisterPostBackControl, on the first change of the SelectedIndex of the DropDownList, the page performed a postback; on the second time, the UpdatePanel performed a partial-page update with the same net result that some form of postback occurred and the event handler was called. After that, however, any further changes of the SelectedIndex did not produce a postback.

After registering the control using RegisterAsyncPostBackControl the behavior was the same as I described in the first post.

Thanks again for taking the time to help; if you have any other suggestions, please let me know.


change or Set the UpdateMode = "Conditional" or "Always" for UpdatePanel

See the results it its' satisfying your requirments.


Thanks to both of you for helping. I've resolved the issue; it had to do with a custom wrapper Sharepoint places around the form when submitting that interferes with the behavior of the UpdatePanel. The solution I found was written up in a Blog post by Mike Ammerlaan:

http://sharepoint.microsoft.com/blogs/mike/Lists/Posts/Post.aspx?ID=3

Dropdownlist inside a User Control (all inside an updatePanel)

Hi there!

I have a dropdownlist with autopostback=true

The dropdownlist is inside a User control dinamically generated inside an update panel.

When I select a different item from the dropdownlist... "DropDownList1_SelectedIndexChanged" and I try to get the SelectedValue, I always get 0. While debuggin I could discover that the number of Items inside the dropdownlist was 0! (and obbiously the dropdownlist was charged with data)

The incredible thing is that after the first postback, I can select items from the dropdownlist and the SelectedIndexChanged gives me the correct SelectedValue!

Someone can help on this?

Many thanks,

Jbmixed

The problem was that I was doing the dopdownlists databind from a public property (I was getting a list of objects).

Now I am only stablishing the property, and I wait to the Load event to do the databind.

I hope this helps other people.