Friday, June 19, 2009

Use Multiple Controls to open ajaxToolkit:CalendarExtender control..

Problem Area: Check out the image above, its showing a calendar control which is being displayed on click of Image button adjacent to text box. Now if you want to display calendar on click of both text box as well as image button then there will be a problem. You can set one control at a time in PopupButtonID property. That means in above scenario either you can use textbox to open this calendar OR you can use image to open calender. Now there is small trick to perform this. Yes, you can use a simple trick and make it open on click of both textbox and image.

Solution: Set PopupButtonID property of the control with multiple control ids as shown in following example.


< ajaxtoolkit:calendarextender id="CalendarExtenderStartDate" runat="server" targetcontrolid="StartDateText" popupbuttonid="StartDateText DateStart">< id="CalendarExtenderStartDate" runat="server" targetcontrolid="StartDateText" popupbuttonid="StartDateText DateStart">


Use popupbuttonid property and specify various control Ids in it.(separated by space)

Thanks....

Friday, June 5, 2009

How to use Text Wrap feature in Mozilla...

For using text wrap in Mozilla you need to perform following steps:


1. Create following javascript function :

function textwrap()
{
if (ie==0)
{
var tag = document.getElementsByTagName("span");
for (var i = 0; i < classname ="=" text_final =" tag.item(i).innerHTML;" re =" /(<([^">]+)>)/gi;
text_final = text_final.replace(re, "")

tag.item(i).innerHTML = text_final.replace(/(.*?)/g, "< wbr >");
}
}
}
}



-------------------------------------------------------------------------------------------

2.
Call textwrap() javascript function on your page and call it only for browser mozilla.....
Here I am assuming that you have already identified the browser type.....

textwrap();


3.
Apply the CSS class named "wraptext" to the label control who's text you want to wrap.
E.g. test.CssClass = "wraptext";


IE can handle word wrap with some CSS properties so there is no need to use above mentioned Javascript function. In case of IE we can simply use following CSS properties:

style="word-wrap: break-word; text-wrap: wrap;"