.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Small problem with displaying custom calendar cell text from db in Safari

Posted By:      Posted Date: October 14, 2010    Points: 0   Category :ASP.Net

using VS2010

I'm using the calendar control to create a simple event calendar. I want to add a small bit of custom text just below the date of any cell that contains an event on that date.

The code:

protected void Calendar1_DayRender(object sender, DayRenderEventArgs e)
      string connString = ConfigurationManager.ConnectionStrings["CalendarConnectionString1"].ToString();
      SqlConnection myConnection = new SqlConnection(connString);
      SqlDataAdapter myAdapter = new SqlDataAdapter("GetEvents", myConnection);
      DataSet myDataSet = new DataSet();
      myAdapter.Fill(myDataSet, "Table");
      //If the month is CurrentMonth
      if (!e.Day.IsOtherMonth)
        foreach (DataRow dr in myDataSet.Tables[0].Rows)
          if ((dr["Date"].ToString() != DBNull.Value.ToString()))
            DateTime dtEvent = (DateTime)dr["Date"];
            if (dtEvent.Equals(e.Day.Date))
              e.Cell.BackColor = Color.MediumAquamarine;
              Label label = new Label();
              label.Text = "</br>";
              label.Text += dr["Title"].ToString();              

View Complete Post

More Related Resource Links

Problem displaying Date from Sql table on Calendar Control

Hi, I am displaying Event dates from SQL table on Calendar Control in ASP.NET. Also, I have GridView Control which shows event details when certain date is clicked on calendar control. But I have a problem as not all dates are displaying properly. Strangly enough only dates which have same month and day date are displayed. For example: It shows ok dates such as 08/08/2010, 09/09/2010, 10/10/2010 etc. If I click on the date which in SQL table exists as 11/25/2010 or 12/15/2010 etc (no matching month/day numbers) it shows error message saying: "System.Data.SqlClient.SqlException: Conversion failed when converting date and/or time from character string."  Follwoing is my code: using System; using System.Collections.Generic; using System.Linq; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; using System.Data.Sql; using System.Runtime.Remoting.Messaging; using System.Configuration; using System.Data.SqlClient; using System.Data; using System.Drawing; public partial class Test_Calendar : System.Web.UI.Page { SqlConnection mycn; SqlDataAdapter myda; DataSet ds = new DataSet(); DataSet dsSelDate; String strConn; private void Page_Load(object sender, System.EventArgs e) { strConn = "Data Source=mydatasource;Initial Catalog=DBname;Persist Security I

mobile web page is displaying with small font in safari on ipod touch and in iphone.


Hi guys,

I had developed mobile web page in asp.net 2.0.

This page is displaying with small font in safari on ipod touch and in iphone.

for this i had copied iphone.browser definition file in C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\CONFIG\Browsers

folder and run the command aspnet_regbrowsers.exe -i in command prompt.

Then 2 files with ASP.BrowserCapsFactory.dll and BrowserCapsFactory.cs were created.

But there is  no result

can any one can solve my problem.

it's urgent


chadra sekhar

Problem when displaying a popup window

Hi all,
I am working on a project in which when I clicked a hyperlink a pop up window has to be displayed for 2 pages.
But at first when i did this in javascript it worked, later after i finished the whole coding suddenly an error box displayed that there is an error in webpage and want to debug

text posing problem in different resolution


Hiiiii coders ,

iam using 14px for my font size in my project . It works fine when i run it on my system. But when i tried to run it on higher resolution the all the text gets shrinked . what is the best way to set font size for my text for all resolutions?

kindly provide me some code snippets.

thanx and regards 

Crystal Reports can grow fields with large amounts of text layout problem


A can grow field in the details section of a crystal report may have so much text that the section will be larger than the remaining space available on the page (the space below the previous record).  The section has vertical lines on it with Extend to bottom of section when printing set to true.  The section starts on a new page (and may continue on the following one).  I want it to start on the page where the last record was laid out, and continue to the new page without leaving a gap with vertical lines on it.  I'm using Crystal Reports 9 and I can't work out how to do it. Has anyone got a solution?

How to add custom list entries to mysite's calendar in Sharepoint 2007 site?


I would like to know below things

(1) How to create MySite for one specific member with other or administrator's access?

(2) Scenario : Administrator have created one SP2007 site. now Administrator have created one calendar (Sample calendar). Administrator have added some entries in calendar. now one user entered in portal site ansd view the calendar and he click on MySite menu. so this sample calendar entries should enter in that user's mysite calendar. How this can be achieved?

Thanks in advance.
Regards, Praful Udade

SharePoint Calendar Error: The "ListViewWebPart" Web Part appears to be causing a problem. Index was

In one specific SharePoint calendar, on one specific week in that calendar when we select the "more items" link in the monthly view (or the expand all option) we get the following error:
The "ListViewWebPart" Web Part appears to be causing a problem. Index was outside the bounds of the array.

Web Parts Maintenance Page: If you have permission, you can use this page to temporarily close Web Parts or remove personal settings. For more information, contact your site administrator.
Troubleshoot issues with Windows SharePoint Services.

If we select a different week the expand and collapse works fine in that calendar.

Applying custom CSS to the MOSS 2007 Calendar control Month view



I have a requirement to use the MOSS 2007 Calendar Control - month view is to apply a custom css to have a look and feel as per our requirements.

We tried applying the custom css to the MOSS 2007 calendar control - month view, it does take the custom css and applies it, but when i click on any date and come back to the calendar control, it changes the CSS of the MOSS calendar control back to the default one.

Let me know if anyone has any suggestion on  how to customize the calendar control for css for our intranet application.

Your response would be highly appreciated.






Problem with SharePoint Designer 2007 and Custom List Forms


I created several forms (Create/Edit/View) for a SharePoint list, using Custom List Forms.  I'm using Content Types in the list to ensure that each item only has the necessary fields.  When I created the ASPX forms, and inserted the Custom List Forms, I selected the correct Content Type, and I got the right fields inserted in the form.

Now, for some reason I can't identify, every time I create a new form, and insert a Custom List Form, SPD is bringing ALL fields from the list, instead of just bringing the fields included in the selected Content Type.

I have tried many different things to solve the problem, including creating new lists/content types/forms, etc. but SPD is doing the same thing all the time.

Can somebody tell me what may have gone wrong in SPD or MOSS?


Problem in Custom Control Unable to find Control To Validate Property


I make a custome control by taking a TextBox and A Regular Expression Validator.When i Use this on a .aspx page it works fine.But when i use this on .ascx page and dynamically load user control on a place holder in .aspx page it through an Error

Unable to find control id '_ctl0:txtEmail' referenced by the 'ControlToValidate' property of '_ctl0:txtEmailRequired'


My Custome control Code is this"--

public class EmailValidator:System.Web.UI.Control, INamingContainer{

private System.Web.UI.WebControls.TextBox textBox;

private System.Web.UI.WebControls.RegularExpressionValidator regularExpressionValidator;

public EmailValidator(){

textBox = new TextBox();

regularExpressionValidator = new RegularExpressionValidator();

IsErrorTextBelow = true;

IsRequired = false;

Displaying transparent text using TextOut

Hi, I'm currently working on a C# project that displays transparent windows (like splashscreens) using Windows Forms. I've been using a class that allows me to call GDI Win32 functions such as UpdateLayeredWindow(), GetDC(), TextOut()... I can show a transparent PNG, it's ok but when I want to add a transparent text with TextOut it works but doesn't follow the form. In the TextOut function, I've tried to specify the HDC of the current form using e.Graphics.GetHdc() without success... Is there a way I can draw my transparent text so it follows the transparent form ? Here is my code, written within the Form_Paint method (private void Form1_Paint(object sender, PaintEventArgs e)). The HDC for the TextOut method used here is null so it draw within the screen DC. IntPtr Hdc = API.GetDC(IntPtr.Zero); IntPtr memDc = API.CreateCompatibleDC(Hdc); IntPtr hBitmap = IntPtr.Zero; IntPtr oldBitmap = IntPtr.Zero; try { //Display-image Bitmap bmp = new Bitmap(backgroundImage); hBitmap = bmp.GetHbitmap(Color.FromArgb(0)); //Set the fact that background is transparent oldBitmap = API.SelectObject(memDc, hBitmap); //Display-rectangle Size size = bmp.Size; Point pointSource = new Point(0, 0); Point topPos = new Point(this.Left, this.Top); e.Graphics.GetHdc() //Set up blending options API.BLENDFUNCTION blend = new API.BLENDFUNCTION(); blend.BlendOp = API.AC_SRC_O

Problem passing custom object returned by the same webservice among two separate projects

I am running into casting issue with this scenario: 1. I made a custom object lets call it EmployeeObject.  2. The Employee object is wrapped in the EmployeeWebservice.  3. I have a client application project lets call it EmployeeClientApplication and a class library called DoSomeWorkClassLibrary.  Both EmployeeClientApplication and DoSomeWorkClassLibrary reference the EmployeeWebService and need to be able to pass the EmployeeObject back and forth.  4. The EmployeeClientApplication also references the DoSomeWorkClassLibrary. 5. The employeeObject in the EmployeeClientApplication becomes EmployeeClientApplication.EmployeeWebService.EmployeeObject. 6. The employeeObject in the DoSomeWorkClassLibrary becomes DoSomeWorkClassLibrary.EmployeeWebService.EmployeeObject. 7. The DoSomeWorkClassLibrary has a method called DoSomeWork that takes an EmployeeObject. When I try to pass employeeObject from EmployeeClientApplication to DoSomeWorkClassLibrary by doing something like this: DoSomeWorkClassLibrary.DoSomeWork(EmployeeClientApplication.EmployeeWebService.EmployeeObject), I am getting Unable to convert EmployeeClientApplication.EmployeeWebService.EmployeeObject to DoSomeWorkClassLibrary.EmployeeWebService.EmployeeObject.  I have searched high and low to fix this issue, I have tried changing the namespace of the reference.cs file of the webservice in

Problem with Ajax calendar extender visibility

sir i am using ajax calender extender in textbox below this textbox i am using a panel there is a gridview that show data.problem is when i click the textbox half of the calender id hiden behind the panel how to solve this problem. 

Cannot delete custom column in calendar list - 'unknown error'

I've created a column in a calendar list and now cannot delete it.  I've cleared all data and I still get the "Unknown Error" message when I try to delete. jan

Problem displaying a page using window.showModalDialog when resizing it.

 Hi, I have a page that is displayed using window.showModalDialog, when the page is resized the tables, text boxes and everything else that is in the page with the width 100% doesn't resize (fit the page) unless a post back is used.How can I make the page keep everything in proportion when it is resized without the need to post back? 

Displaying Calendar Description Field In Calendar View

In the default "out of the box" calendar view it only shows the Title of a calendar event. Is there any way to show not only the Title field but also the Description field?

Custom Web Part Problem After SharePoint Restore

Hi, I've recently moved our sharepoint site and databases (using Microsoft Internal Database) to another standalone server. I did a catastrophic backup and then restored it on the destination server successfully via the central Administration page. I have also copied our custom web part library dll to 'c:\windows\assembly' directory and 'C:\Inetpub\wwwroot\wss\VirtualDirectories\80\bin' directory. I also copied over the old web.config file to 'C:\Inetpub\wwwroot\wss\VirtualDirectories\80'. However, I still seem to be missing something as I get the error below while loading the site. I haven't been able to find a solution so hoping someone has seen it before here. Has anyone seen this happen before? Any advice/help would be greatly appreciated. Many thanks. Mehds ERROR====================================================================================================== The “webpartname” web part appears to be causing a problem. Object reference not set to an instance of an object.  Web parts maintenance page: if you have permission, you can use this page to temporarily close web parts or remove personal settings. For more information, contact you site administrator. ==========================================================================================================
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend