Showing posts with label file. Show all posts
Showing posts with label file. Show all posts

Monday, March 26, 2012

My Calendar (AJAX asp.net) get NUTS? Only shows 5 days, instead of 7 days

Hi,

the problem is that my calendar shows only 5 days instead of 7 days. Any IDEAS? There is no (code-behind) code in CS file that does hide weekend.

here is a code

<asp:TextBox runat="server" ID="TBsearchFrom" Columns="10" />
<asp:TextBox runat="server" ID="TBsearchTo" Columns="10" />
<ajaxToolkit:CalendarExtender ID="cldFrom" runat="server"
TargetControlID="TBsearchFrom"
CssClass="MyCalendar"
Format="MM/dd/yy"
OnClientDateSelectionChanged = "function(e){calendar_hide(e);}"
FirstDayOfWeek="Monday"

/>
<ajaxToolkit:CalendarExtender ID="cldTo" runat="server"
TargetControlID="TBsearchTo"
CssClass="MyCalendar"
Format="MM/dd/yy"
OnClientDateSelectionChanged = "function(e){calendar_hide(e);}"
FirstDayOfWeek="Monday"
/>
<br/>


I had this same issue. The problem was that the calendar was picking up on CSS set for my site, which didn't have the right padding for each of the calendar's components. What I did was copy the calendar's padding properties in the CSS from the example in the toolkit and paste it into my CSS file, and customized the colors from there.

Hi there,

I am having the same kind of problem, my calendar control is contained within a detailsview. I have added the css to look like this

.MyCalendar.ajax__calendar_container {

border:1pxsolid#646464;

background-color:#ffffff;

color:#000000;

}

.MyCalendar

.ajax__calendar_footer {border-top:1pxsolid#f5f5f5;

}

.MyCalendar

.ajax__calendar_dayname {border-bottom:1pxsolid#f5f5f5;

}

.MyCalendar

.ajax__calendar_day {border:1pxsolid#ffffff;

}

.MyCalendar

.ajax__calendar_month {border:1pxsolid#ffffff;

}

.MyCalendar

.ajax__calendar_year {border:1pxsolid#ffffff;

}

.MyCalendar

.ajax__calendar_active.ajax__calendar_day {background-color:#edf9ff;border-color:#0066cc;color:#0066cc;

}

.MyCalendar

.ajax__calendar_active.ajax__calendar_month {background-color:#edf9ff;border-color:#0066cc;color:#0066cc;

}

.MyCalendar

.ajax__calendar_active.ajax__calendar_year {background-color:#edf9ff;border-color:#0066cc;color:#0066cc;

}

.MyCalendar

.ajax__calendar_other.ajax__calendar_day {background-color:#ffffff;border-color:#ffffff;color:#646464;

}

.MyCalendar

.ajax__calendar_other.ajax__calendar_year {background-color:#ffffff;border-color:#ffffff;color:#646464;

}

.MyCalendar

.ajax__calendar_hover.ajax__calendar_day {background-color:#edf9ff;border-color:#daf2fc;color:#0066cc;

}

.MyCalendar

.ajax__calendar_hover.ajax__calendar_month {background-color:#edf9ff;border-color:#daf2fc;color:#0066cc;

}

.MyCalendar

.ajax__calendar_hover.ajax__calendar_year {background-color:#edf9ff;border-color:#daf2fc;color:#0066cc;

}

.MyCalendar

.ajax__calendar_hover.ajax__calendar_title {color:#0066cc;

}

.MyCalendar

.ajax__calendar_hover.ajax__calendar_today {color:#0066cc;

}

But whenever I open the calender I am only presented with 8 days of the month (the 1st 4 and last 4) I think its a padding issue but I dont know what else to change


Never mind my last post.

But if anyone is having the same problem all you need to do is add some extra css for the body of the calendar.

In my case I had mine within a td

.MyCalendar

td

{

padding:0px,0px,0px,0px;border-spacing:0px;padding-top:0px;padding-right:0px;padding-bottom:0px;padding-left:0px;

}

my err on server - please

what to do?? and what is it?? - i am a biginer..

Description:An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message:Could not load file or assembly 'System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies. The system cannot find the file specified. (d:\webspace\ADMIN\yanivsplace.com\WWW\web.config line 52)

Source Error:

Line 50: </httpHandlers>Line 51: <httpModules>Line 52: <add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>Line 53: </httpModules>Line 54: </system.web>


Hi,

and welcome to the ASP.NET forums.

Did you install the ASP.NET AJAX Extensions properly on your computer (http://ajax.asp.net/downloads/default.aspx?tabid=47)?

Grz, Kris.


Thank you for welcomingAnd yes I did installedASP.NET AJAX Extensions Now on my machine there is no problems – its runs..

But when I tried to upload the files to ftp I got this problem


y4all:

on my machine there is no problems – its runs..

But when I tried to upload the files to ftp I got this problem

Does the server where you ftp'ed your files to also have the extensions installed as well?

Grz, Kris.


I hade my doubts but is the first time that I try to upload files to a server –

thanx


Hi,

y4all:

I try to upload files to a server

The AJAX extensions must be installed by your hosting company on their server. Not by you. If you have any doubts regarding that, contact their help desk to make sure they've installed it or going to install it.

Grz, Kris.


Yes they do supportAjax

thanks


Add a reference to system.web.extensions or system.web in your project.. this will solve the issue..right click "bin" click "Add reference" in .NET tab there will select system.web or system.web.extensions or both...


first thak you.

so first I didn't had a bin folder – so I added 1 (asp:bin folder) then I did select thereferences and clicked ok but files where added to the bin – the folder was empty

Wednesday, March 21, 2012

Need help downloading a file to clients computer

I really hope one of you guys can help me with this becauseI have been trying to fix this for a week and I am no further down the roadthan when I started. The task I amtrying to accomplish is this:

User clicks a button which starts an asynchronous processwhich creates an Excel spreadsheet. Thisprocess takes about 5 or 10 minutes. Screenupdates are sent as process runs. At theconclusion of the process I want to download the excel file to the userscomputer and therein lies the problem.

The way I have it rigged now is that a timer control insidean update panel ticks which allows screen updates to happen. This works fine.

When the async process is done, it enables a timer which isoutside the update panel. The synchronoustimer downloads the file however there is no way to disable the timer. I know this wrong however I have no idea howto fix it. The code below illustratesthe general architecture of what I have now. Any help is much appreciated.

using System;using System.Data;using System.Configuration;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;using System.Security.Principal;using System.IO;public partialclass Worker : System.Web.UI.Page{protected void Page_Load(object sender, EventArgs e) {if (IsPostBack) { Label2.Text = (string)Session["jobStatus"]; }else { Session["jobCompleted"] =false; Session["userCanceledJob"] =false; Session["jobStatus"] =null; Session["jobObject"] =null; } }private void Notify(string msg) { Label2.Text = msg +" - Current time is " + DateTime.Now.ToLongTimeString(); Session["jobStatus"] = Label2.Text; }private void ProcessCompleteCallBack(IAsyncResult result) {// This is is called when the asycronous process is completed. workerDelegate worker = (workerDelegate)result.AsyncState; worker.EndInvoke(result); Session["jobCompleted"] =true; }protected void Timer1_Tick(object sender, EventArgs e) {//This timer causes an asycronous postback. Label3.Text ="Timer ticked at " + Environment.NewLine + DateTime.Now.ToLongTimeString();if ((bool)Session["jobCompleted"]) { Timer1.Enabled =false; Sync_Timer.Enabled =true; StartButton.Enabled =true; CancelButton.Enabled =false; Label1.Text ="No processes are running."; Label3.Text =""; } }protected void StartButton_Click(object sender, EventArgs e) { StartButton.Enabled =false; CancelButton.Enabled =true; WindowsIdentity winIdentity = WindowsIdentity.GetCurrent(); WorkingClass me =new WorkingClass(); messangerDelegate notify =new messangerDelegate(Notify); workerDelegate worker =new workerDelegate(me.VeryLongProcess); worker.BeginInvoke(notify, winIdentity,new AsyncCallback(ProcessCompleteCallBack), worker); Timer1.Interval = 2000; Timer1.Enabled =true; Label1.Text ="Process started at " + DateTime.Now.ToLongTimeString(); Session["jobCompleted"] =false; Session["userCanceledJob"] =false; Session["jobStatus"] =""; Session["jobObject"] = me; }protected void CancelButton_Click(object sender, EventArgs e) { Session["userCanceledJob"] =true; WorkingClass me = (WorkingClass)Session["jobObject"]; me.CancelJob =true; }protected void Sync_Timer_Tick(object sender, EventArgs e) {// This timer causes a synchronis postback (?) // The timer never gets disabled Sync_Timer.Enabled =false; DownloadThis("import.txt",true); }private void DownloadThis(string fname,bool forceDownload) {// Download Excel file to clientstring path = MapPath(fname);string name = Path.GetFileName(path);string ext = Path.GetExtension(path);string type ="";// set known types based on file extensionif (ext !=null) {switch (ext.ToLower()) {case".htm":case".html": type ="text/HTML";break;case".txt": type ="text/plain";break;case".doc":case".rtf": type ="Application/msword";break; } }if (forceDownload) { Response.AppendHeader("content-disposition","attachment; filename=" + name); }if (type !="") Response.ContentType = type; Response.WriteFile(path); Response.End(); }}public class WorkingClass{public bool CancelJob;public void VeryLongProcess(messangerDelegate notify, System.Security.Principal.WindowsIdentity identity) {// Create Excel file here WindowsImpersonationContext impContext = identity.Impersonate();int recordCount = 10;string msg ="";this.CancelJob =false;for (int i = 1; i <= recordCount; i++) { msg ="Now processing record " + i.ToString() +" of " + recordCount.ToString(); notify(msg);if (!this.CancelJob) System.Threading.Thread.Sleep(500);else { msg ="Job canceled.";break; } }if (msg !="Job canceled.") msg ="Job completed."; notify(msg); }}public delegate void messangerDelegate(string msg);public delegate void workerDelegate(messangerDelegate notify, System.Security.Principal.WindowsIdentity winIdentity);
 
 <%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeFile="DownLoadWorker.aspx.cs" Inherits="Worker" debug="true"%
<!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>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<script type="text/javascript" language ="javascript">
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);

function EndRequestHandler(sender, args)
{
//alert('hello there');
//window.open('http://www.ibm.com',target='new');
}
</script>
<br />
<br />
<asp:Label ID="Label4" runat="server" Font-Bold="True" Font-Size="16pt" Text="DownLoad Worker"
Width="192px"></asp:Label><br />
<br />

<br />

<br />

<br />
<asp:Panel ID="MainPanel1" runat="server" Height="256px" Width="472px">
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<br />
<asp:Label ID="Label1" runat="server" Height="64px" Text="No processes are running." Width="344px"></asp:Label><br />
<br />
<asp:Label ID="Label2" runat="server" Height="64px" Width="344px"></asp:Label><br />
<br />
<asp:Label ID="Label3" runat="server" Height="64px" Width="344px"></asp:Label><br />
<br />
<br />
<br />
<asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick" Enabled="False" Interval="2000">
</asp:Timer><asp:Button ID="StartButton" runat="server" OnClick="StartButton_Click" Text="Run a long Process"/> <br />
<asp:Button ID="CancelButton" runat="server" Text="Cancel Process" Enabled="False" OnClick="CancelButton_Click" /><br />
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<br />
<br />
<br />
<br />
<br />
<asp:Timer ID="Sync_Timer" runat="server" OnTick="Sync_Timer_Tick" Interval="5000" Enabled="False">
</asp:Timer>
</div>
</form>
</body>
</html

So is the file downloading? or is it not downloading? What is the actual problem? Above you say that it works, but you can't disable the timer... is that your only issue? (a timer not being disabled... so I'm guessing it promts to download the file over and over again)?

Please explain.

Thanks,


Working...??

Solve the issue ot not yet?

Need help I think it is Ajax issue

Can someone what this is related to and how to fix?

Configuration Error

Description:Anerror occurred during the processing of a configuration file requiredto service this request. Please review the specific error details belowand modify your configuration file appropriately.

Parser Error Message:Couldnot load file or assembly 'Microsoft.Web.Extensions,Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'or one of its dependencies. The system cannot find the file specified.(D:\mac.shotdrive.com\web.config line 55)

ne 53: </httpHandlers>
Line 54: <httpModules>
Line 55: <add name="WebResourceCompression" type="Microsoft.Web.Handlers.WebResourceCompressionModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 56: <add name="ScriptModule" type="Microsoft.Web.UI.ScriptModule, Microsoft.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
Line 57: </httpModules>

Hi

one thing i need to know..

are u using old version of AJAX? because Microsoft.Web.XXX is old version


it has been a couple of months since I updated my ajax so if the newest version came out after that then yes
You are using an older RC version RC1 or below as RC2 got rid of the wbe.confi entry for compression as it was built into the RC2 release... Follow the migration guides onhttp://ajax.asp.net/default.aspx?tabid=47 and upgrade :) The bestest advice..
Cool Cool I will look into that as soon as I get home from work tonight... Thank you

Need help with implementing a pattern for asynchronous requests/responses in a loop

Here is the pseduo code for what I need to do:

Get URL
For each element in XML file (currently 8)
Extract URL
Get URL
For each element in XML file2 (between 1 and 8)
Extract URL
Get URL
For each element in XML file3 (between 1 and 10)
process elements
Loop
Loop
Loop

I could easily do this using synchronous xmlhttp calls, but I am also trying my best to avoid that. The problem is that I can't think of a clean way to do this using asynchronous calls. Can any one assist with a pattern that would do this?

Cheers,

Scott

P.S. This needs to be done on the client as I am not willing to use my own server here. Although, I have considered something like Yahoo! Pipes or Microsoft's PopFly to mash this information up for me.

Hi,

Thank you for your post!

As far as I know, there is no built-in support for this usage in MS AJAX 1.0/3.5.

I think the most flexible way to do it is to use directly synchronous xmlhttp calls.

If you have further questions,let me know.

Best Regards,