Important Silverlight Tutorials for Beginners
Important FAQ questions for WPF and SilverLight:
- What is the need of WPF when we had GDI, GDI+ and DirectX?
- How does hardware acceleration work with WPF?
- Does that mean WPF has replaced DirectX?
- So can we define WPF in a precise way?
- What is XAML?
- So is XAML meant only for WPF ?
- Can you explain the overall architecture of WPF?
- Which are the different namespaces and classes in WPF ?
- Can explain the different elements involved in WPF application practically?
- What are dependency properties?
- Are XAML file compiled or built on runtime?
- Can you explain how we can separate code and XAML?
- How can we access XAML objects in behind code?
- What kind of documents are supported in WPF?
- What is SilverLight ?
- Come on, even WPF runs under browser why SilverLight ?
- Can SilverLight run in other platforms other than window?
- What is the relationship between Silver Light, WPF and XAML?
- Can you explain SilverLight architecture?
SilverLight FAQ part 2 (Animations and Transformations)
- What is the definition of animation from Silver light perspective?
- What is a timeline in Silver light?
- What are the different kinds of animation supported by Silverlight?
- Can you explain doubleanimation , coloranimation and pointanimation ?
- What is a story board?
- Can we see a simple silverlight animation to just get started?
- What are the different ways in which silver light does transformation?
- Silverlight VS Flash good news and bad news
SilverLight’s FAQ – Part 3
- Can you explain one way and two way bindings?
- Can you explain One time binding?
- Can you demonstrate a Simple example of OneWay and TwoWay?
- What are the different ways provided to do layout in SilverLight?
- Can you explain how Canvas layout actually works?
- How can we implement Grid Layout?
- How can we implement Stack Layout?
- What are the different steps involved in consuming WCF service in Silverlight?
- Why can’t we consume ADO.NET directly in SilverLight?
- How can we do database operation using SilverLight?
How do we create,Read,Delete Cookies in Asp.net
A cookie is a small bit of text file that browser creates and stores on your machine (hard drive). Cookie is a small piece of information stored as a string. Web server sends the cookie and browser stores it, next time server returns that cookie.Cookies are mostly used to store the information about the user. Cookies are stores on the client side.
Here i m going to explain you by providing example of Remember me Code :
Step 1 : if check box is checked for “Remember Me” then create cookie else Delete it.
if (chkRememberMe.Checked == true)
{
//Create Cookie to Store AdminInfo
HttpCookie aCookie = new HttpCookie("AdminInfo");
aCookie.Values["userName"] = txtUsername.Text;
aCookie.Values["Password"] = txtPassword.Text;
aCookie.Values["lastVisit"] = DateTime.Now.ToString();
aCookie.Expires = DateTime.Now.AddDays(10);
Response.Cookies.Add(aCookie);
}
else
{
//Delete Cookie
HttpCookie aCookie = new HttpCookie("AdminInfo");
aCookie.Expires = DateTime.Now.AddDays(-1);
Response.Cookies.Add(aCookie);
}
Step 2 : now check cookie is null or not in page load event & set username & password from cookie
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
if (Request.Cookies["AdminInfo"] != null)
{
txtUsername.Text = Request.Cookies["AdminInfo"]["userName"] == null ? null : Request.Cookies["AdminInfo"]["userName"].ToString();
string pwd = Request.Cookies["AdminInfo"]["Password"] == null ? null : Request.Cookies["AdminInfo"]["Password"].ToString();
txtPassword.Attributes.Add("value", pwd);
}
}
}
Spell Checker Configuration with FCK Editor
FCKeditor comes with built-in integration with two spell checkers: ieSpell and Speller Pages. Here you will find information about these spell checkers and how to configure them.
ieSpell
As the name says, ieSpell is an extension for Internet Explorer that does spell checking at the client side. It is quite simple and efficient, but it runs on IE/Windows only.
To use ieSpell just set the following configuration in fckconfig.js or in your own Configuration File:
FCKConfig.SpellChecker = ‘ieSpell’ ;
The first time a user runs the Spell Checker, he/she will be automatically informed that ieSpell is not installed and will be redirected to the download URL (the URL can also be configured using IeSpellDownloadUrl option).
When running FCKeditor with ieSpell with non-IE browsers, the "Check Spell" button will be automatically disabled.
NOTE: ieSpell is free for personal use. Commercial licenses are available for very low prices. For more info about ieSpell, its licensing, configurations and more, go to http://www.iespell.com/.
Speller Pages
Speller Pages is a free, Open Source, server side spell checker that uses the powerful GNU Aspell engine for the hard work. This should be the preferred spell checker, but it requires some server side configuration (this is why it is not set as the default one).
To use Speller Pages just set the following configuration in fckconfig.js or in your own Configuration File:
FCKConfig.SpellChecker = ‘SpellerPages’ ;
FCKeditor uses a customized version of Speller Pages, so any specific configuration must be done in the files found at: editor/dialog/fck_spellerpages/spellerpages. All changed lines have been marked with a "by FredCK" comment.
The files included in the package are set to run over Windows with PHP. Useful information about Windows configuration can be found here: Installation Instructions.
If the server is not Windows just go to to the spellerpages/server-scripts directory, locate the appropriate file and adjust the var that holds the path to the aspell binary.
For more info about Speller Pages, its licensing, installation, configuration and more, go to http://spellerpages.sourceforge.net/.
Reference Site : http://docs.fckeditor.net/FCKeditor_2.x/Developers_Guide/Configuration/Spell_Checker
Print in ASP.NET 2.0
Option 1 : Using ASP.NET (C# / VB )
One of the most common functionality in any ASP.NET application is to print forms and controls. There are a lot of options to print forms using client scripts. In the article, we will see how to print controls in ASP.NET 2.0 using both server side code and javascript.
Option 2 : Using Javascript
In the article, we will see how to print controls in ASP.NET 2.0 using javascript.
Option 3 : Printing a GridView with Paging
This is a WebControl that provides an easy way to prepare an ASP.NET GridView to be paged and printed in the browser.
How to play music in background
I want to create noisy websites. All of our desktop applications make sounds. It seems completely unfair that our websites are so quiet.
Methods are:
- <bgsound> tag
- <embed> tag
- <object> tag
1. <bgsound> tag
Here’s how you add sound with the <bgsound> tag:
<bgsound src=”test.wav” />
The <bgsound> tag is the tag that gave sound a bad name. This is the tag that everyone adds to their websites to create the endlessly looping background music. The <bgsound> tag was introduced into the world (in the same month) with the release of Microsoft Internet Explorer 2.0 and Mosaic 2.1. Opera supports the <bgsound> tag, but Firefox does not.
Since the <bgsound> was never incorporated into any web standards (you won’t find any mention of the tag in either the HTML or XHTML standards), most web authors avoid this tag as outdated and dead. Typically, you are encouraged not to use the <bgsound> tag in favor of either the <embed> or <object> tag.
However, I use the <bgsound> sound tag in the Javascript that I develop at the end of this post. There is one very important advantage of the <bgsound> tag. The <bgsound> tag does not cause the information bar to popup in Internet Explorer when you use this tag in a page.
The Internet Explorer version of this tag has four important properties:
• Balance – Enables you to specify the balance between the left and right speaker
• Loop – Enables you to specify the number of times that the sound will repeat. The value -1 means loop infinitely
• Src – Enables you to specify the URL to the sound file
• Volume – Enables you to specify the volume of the sound (valid values range from -10,000 to 0)
2. <embed> tag
Here’s how you use the <embed> tag:
<embed src=”test.wav” type=”audio/x-wav” />
The src attribute points to the sound file and the type attribute specifies the MIME type of the file. Notice that the MIME type of a .wav sound file is indicated with the MIME type audio/x-wav. The x means that .wav is a custom type. Using the x is necessary because the .wav sound file format does not have a registered MIME type at IANA.
The <embed> tag is not limited to sounds. You can use the <embed> tag to embed a variety of different types of objects in a page including videos and pictures.
There’s no master list of valid attributes for the <embed> tag. Different types of objects that you embed in a document will support different attributes. For example, on my computer, Windows Media Player is mapped to the .wav extension. Therefore, I can use Windows Media Player attributes with the <embed> tag.
One problem with using the <embed> tag is that you must have an application mapped to the type of file being downloaded. Unfortunately, on my computer, there was no application mapped to the .wav extension by default. When I initially requested a page that contained an embedded .wav file, I got the Internet Explorer information bar.
Since I don’t want to inflict the Internet Explorer information bar on users when playing sounds, I don’t use the <embed> tag in the Javascript at the end of this article. The <bgsound> element enables us to play .wav files without displaying the information bar.
3. <object> tag
The <object> tag is very similar to the <embed> tag. It allows you to embed objects in a page like this:
<object data=”test.wav” type=”audio/x-wav” />
Notice that the <object> tag uses the data attribute and not the src attribute to point to a file.
The difference between the <embed> tag and the <object> tag is that the latter tag is supported by W3C web standards. If creating standards compliant websites is important to you, then you should use this tag.
Just like in the case of the <embed> tag, there is no master list of attributes for the <object> tag. The list of valid attributes all depends on the application or plug-in being used to display the embedded object.
Unfortunately, when used with Internet Explorer, the <object> tag causes the Internet Explorer information bar to popup just like the <embed> tag. In the Javascript at the end of this article, I use the <bgsound> tag for Internet Explorer and the <object> tag for every other browser.
Generating Sounds with Javascript
PlaySound.js
if (window.attachEvent)
window.attachEvent(”onload”, setupPlaySound);
else
window.addEventListener(”load”, setupPlaySound, false);
function setupPlaySound()
{
if (navigator.appName == “Microsoft Internet Explorer”)
{
var snd = document.createElement(”bgsound”);
document.getElementsByTagName(”body”)[0].appendChild(snd);
playSound = function(url)
{
snd.src = url;
}
}
else
{
playSound = function(url)
{
var obj = document.createElement(”object”);
obj.width=”0px”;
obj.height=”0px”;
obj.type = “audio/x-wav”;
obj.data = url;
var body = document.getElementsByTagName(”body”)[0];
body.appendChild(obj);
}
}
}
The first lines of the Javascript create an event handler for the browser window load event. Internet Explorer uses the attachEvent() method to create an event handler and other browsers use the addEventListener() method.
The setupPlaySounds() method is called after the window is loaded. This method creates the playSound() method. Javascript enables you to conditionally create different versions of a function. There is one version of the playSound() method that is created in the case of Internet Explorer and another version that is created in the case of every other browser.
The Internet Explorer version of the playSound() method takes advantage of the <bgsound> tag to play a sound. The alternative playSound() method takes advantage of the <object> tag. If you link the Javascript file above into an ASP.NET page, then you can play a sound by calling the playSound() method and passing the URL of a sound file. You can link the PlaySound.js file to an ASP.NET page by adding the following tag to the page:
<script type=”text/javascript” src=”PlaySound.js”></script>
And, adding the following link to a page will cause the sound file ClickHere.wav to play whenever you hover your mouse over the link.
<a href=”SomePage.htm” onmouseover=”playSound(’ClickHere.wav’)”>Click Here!</a>
The playSound() method works with recent versions of Internet Explorer, Firefox, and Opera.
How to call a function from .aspx.cs file to .aspx file
Hi, U can use the .cs side function in .aspx side something below given method
I have created the following method in .cs side
public int GetNoOfForums(int groupId)
{
ForumCollection forums = new ForumCollection();
return forums.GetNoOfForums(groupId);
}
After that we call that method in .aspx something like below.
<asp:DataList ID=”dlstGroup” runat=”server” OnItemCommand=”dlstGroup_ItemCommand”
OnItemDataBound=”dlstGroup_ItemDataBound” >
<HeaderTemplate>
<tr>
<th>
<b>Created By</b>
</th>
<th style=”font-weight: bold;”>
No. of Forums
</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr>
<td align=”left”>
<%#Eval(”CreatedByUserName”) %>
</td>
<td align=”left”>
<asp:Label ID=”lblStatus” runat=”server” Text=’ <%#Eval(”Status”) %>’></asp:Label>
</td>
<td align=”center”>
<%#GetNoOfForums(Convert.ToInt32(Eval(”GroupID”)))%>
</td>
</tr>
</ItemTemplate>
</asp:DataList>
Building a Type-Ahead Dropdown Control
The ASP.NET DropDownList control does not offer type-ahead functionality. Often users have to scan through hundreds of items before making a selection. This article shows how to easily implement type-ahead functionality in a dropdown that will be a hit with your users.
Two-way data binding in 3-Tier web application
In this article I would like to examine two-way data-binding in 3-tier web application and how using XLib library can substantially decrease the amount of data-binding code without compromising the amount of control you have over it. I start by describing the ways data flow has been handled in 3-tier applications and how XLib improves upon it.
-
Archives
- July 2009 (2)
- June 2009 (2)
- May 2009 (4)
- April 2009 (13)
- March 2009 (3)
- February 2009 (5)
- January 2009 (4)
- December 2008 (3)
- November 2008 (17)
- October 2008 (15)
- August 2008 (1)
- July 2008 (10)
-
Categories
-
RSS
Entries RSS
Comments RSS