Here is some basic animation one can associate with the collapsible panel control -
<%--
<cc1:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server"
TargetControlID="Panel1"
CollapsedSize="0"
Collapsed="True"
AutoCollapse="False"
AutoExpand="False"
ScrollContents="True"
ExpandControlID="lblPanel1"
CollapseControlID="lblPanel1"
CollapsedText="Show Details..."
ImageControlID="imgDraft"
ExpandedText="Hide Details"
CollapsedImage="~/Images/collapse.gif"
ExpandedImage="~/Images/expand.gif"
ExpandDirection="Vertical"
/>
<cc1:AnimationExtender ID="AnimationPanel" runat="server" TargetControlID="lblPanel1" >
<Animations>
<OnClick>
<Sequence>
<EnableAction Enabled="false" />
<FadeOut AnimationTarget="Panel1"
Duration=".2" ></FadeOut>
<FadeIn AnimationTarget="Panel1"
Duration=".1" ></FadeIn>
<EnableAction Enabled="true" />
</Sequence>
</OnClick>
</Animations>
</cc1:AnimationExtender>
--%>
By using the AnimationTarget property of animation extender , i have associated only the panel to animate, so u do not have to give CollapsiblePanelExtender for the TargetControlID ,doing so will will trigger the animation whenever and where ever you click on the CollapsiblePanelExtender control
Friday, January 15, 2010
Thursday, January 14, 2010
Session loss using AJAX
It sounded strange to me .... but the problem is a prevailing one. Your pages without AJAX works fine while the ones with AJAX doesn't and tend to lose their sessions without giving me errors. In my case I am the admin of a site and can login into anyone's account. I introduced AJAX toolkit for the first time, and while i tried to impersonate as someone else and issued a postback on ajax toolkit containing pages, it reverted me back to my original ID. Tried to find the solution to it, went through various forums but to no avail. Finally i realised that the application is going to the page where i have set the sessions for logging in (in my case i have a login page which is invisible to the user and picks up the credentials automatically from the intranet account)
So went to INETMGR and the properties of my default wesite , then to the tab documents.There i removed the non-important pages and added a single page. It worked for me , might for you, or probably its a specific case. But do give it a shot if u don't find the solution elsewhere.
So went to INETMGR and the properties of my default wesite , then to the tab documents.There i removed the non-important pages and added a single page. It worked for me , might for you, or probably its a specific case. But do give it a shot if u don't find the solution elsewhere.
TabContainer Animation on tab change
The AJAX animation extender when applied on Tabcontainer on "onclick" event produces some good results, but the problem arises when you click anywhere on the tab and the animation is fired which you dont want to happen. You just want the animation to fire at tab change.
Solution = Found some good code for it , tweaked it as per the requirements. Here is it -
<%--
<cc1:TabContainer ID="TabContainer1" runat="server" EnableViewState ="true" OnClientActiveTabChanged = "ActiveTabChanged" >
<cc1:TabPanel ID = "panel1" HeaderText = "panel1" runat ="server" Enabled ="true" >
<ContentTemplate>
--Your Content
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID = "panel2" HeaderText = "panel2" runat ="server">
<ContentTemplate>
--Your Content
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID = "panel3" HeaderText = "panel3" runat ="server" Width = "500px" >
<ContentTemplate>
--Your Content
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
<script type="text/javascript">
function ActiveTabChanged(sender, e)
{
var Tab = $get('<%=TabContainer1.ClientID%>'); }
AnimateTab(Tab );
}
var HighlightAnimations = {};
function AnimateTab(el)
{
if (HighlightAnimations[el.uniqueID] == null)
{
HighlightAnimations[el.uniqueID] = AjaxControlToolkit.Animation.createAnimation({
AnimationName : "FadeOut",
duration : 0.5,
AnimationName : "FadeIn",
duration : 0.5
}, el);
}
HighlightAnimations[el.uniqueID].stop();
HighlightAnimations[el.uniqueID].play();
}
</script>
--%>
Solution = Found some good code for it , tweaked it as per the requirements. Here is it -
<%--
<cc1:TabContainer ID="TabContainer1" runat="server" EnableViewState ="true" OnClientActiveTabChanged = "ActiveTabChanged" >
<cc1:TabPanel ID = "panel1" HeaderText = "panel1" runat ="server" Enabled ="true" >
<ContentTemplate>
--Your Content
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID = "panel2" HeaderText = "panel2" runat ="server">
<ContentTemplate>
--Your Content
</ContentTemplate>
</cc1:TabPanel>
<cc1:TabPanel ID = "panel3" HeaderText = "panel3" runat ="server" Width = "500px" >
<ContentTemplate>
--Your Content
</ContentTemplate>
</cc1:TabPanel>
</cc1:TabContainer>
<script type="text/javascript">
function ActiveTabChanged(sender, e)
{
var Tab = $get('<%=TabContainer1.ClientID%>'); }
AnimateTab(Tab );
}
var HighlightAnimations = {};
function AnimateTab(el)
{
if (HighlightAnimations[el.uniqueID] == null)
{
HighlightAnimations[el.uniqueID] = AjaxControlToolkit.Animation.createAnimation({
AnimationName : "FadeOut",
duration : 0.5,
AnimationName : "FadeIn",
duration : 0.5
}, el);
}
HighlightAnimations[el.uniqueID].stop();
HighlightAnimations[el.uniqueID].play();
}
</script>
--%>
Tuesday, January 5, 2010
Cannot access a closed file - file upload asp.net
REQUIRMENT - Need to upload a file after confirmation (ok-cancel) popup.
FIGHT -1 - The posted file from file upload control is removed as soon as the page is posted back.
SOLUTION - Save the posted file in a session as u press the upload document button you created, something like this -
protected void btnUploadDocument_Click(object sender, EventArgs e)
{
Session["UploadFile"] = FileUploadControl.PostedFile;
//pop up code
}
Then the confirmation pop-up props up. On selecting 'OK' cast the session as HttpPostedFile , something like this -
(HttpPostedFile)Session["UploadFile"]
Use this to upload the document.
FIGHT -2 - Error - Cannot access Closed File
SOLUTION- maxRequestLength, an attribute which governs the size of file being uploaded might have not been updated.
By default it is 4 mb. to increase it , < httpRuntime maxRequestLength="20000" /> within the
tag in the web.config (put the value as required)
The problem might still persist , the root lies in requestLengthDiskThreshold attribute
update the above mentioned tag to -
< httpRuntime maxRequestLength="20000" requestLengthDiskThreshold="9000"/ >
(For more info on the two attribures , go to - http://msdn.microsoft.com/en-us/library/e1f13641.aspx)
FIGHT -1 - The posted file from file upload control is removed as soon as the page is posted back.
SOLUTION - Save the posted file in a session as u press the upload document button you created, something like this -
protected void btnUploadDocument_Click(object sender, EventArgs e)
{
Session["UploadFile"] = FileUploadControl.PostedFile;
//pop up code
}
Then the confirmation pop-up props up. On selecting 'OK' cast the session as HttpPostedFile , something like this -
(HttpPostedFile)Session["UploadFile"]
Use this to upload the document.
FIGHT -2 - Error - Cannot access Closed File
SOLUTION- maxRequestLength, an attribute which governs the size of file being uploaded might have not been updated.
By default it is 4 mb. to increase it , < httpRuntime maxRequestLength="20000" /> within the
tag in the web.config (put the value as required)
The problem might still persist , the root lies in requestLengthDiskThreshold attribute
update the above mentioned tag to -
< httpRuntime maxRequestLength="20000" requestLengthDiskThreshold="9000"/ >
(For more info on the two attribures , go to - http://msdn.microsoft.com/en-us/library/e1f13641.aspx)
Subscribe to:
Posts (Atom)