Sunday, May 15, 2011

Validation In Silverlight 4


The new Validation states for controls in Silverlight 4 sure look nice but there are a number of limitations. For starters, you can only invoke them through:
  • An exception thrown by a bound property setter
  • An exception thrown by a ValueConverter
The latter feels particularly unsavoury as you'll need to reuse the same converter wherever you want to bind to that property - a big violation of the DRY principle.
You can't even use the new ValidationAttributes from System.ComponentModel.DataAnnotations. Well, actually you can but you'd have to this inside the setter:


 private string _ArtCategory;


        public string ArtCategory
        {
            get { return _ArtCategory; }
            set 
            {
                   if(value=="")
                       {
                           throw new Exception("Invalid Category!!");
                       }
                    else
                   _ArtCategory = value;
            }
        }


And This is bound to a TextBox: 




<TextBox Height="23" Text="{Binding Path=ArtCategory,Mode=TwoWay,ValidatesOnExceptions=True,NotifyOnValidationError=True}" HorizontalAlignment="Left" Margin="119,3,0,0" Name="txtCategory" VerticalAlignment="Top" Width="231" />




Now, to get this working on any scale is going to require code-behind. Lots of code-behind. And everybody knows I hate this. The whole validation story at the moment isn't going to play at all well with Model-View-ViewModel (MVVM).

Sunday, February 27, 2011

What Is Entity Framework??


.edmx File(Entity Framework)


An .edmx file is an XML file that defines a conceptual model, a storage model, and the mapping between these models. An .edmx file also contains information that is used by the ADO.NET Entity Data Model Designer (Entity Designer) to render a model graphically. The recommended practice for creating an .edmx file is to use the Entity Data Model Wizard.

Changes are made to an .edmx file when you use the Entity Designer to modify your model and when you use the Update Model Wizard to update your model based on changes to the underlying database. . There are also some scenarios in which you might have to edit an .edmx file manually.


By default, an .edmx file opens with the Entity Designer. However, you can open an .edmx file with the XML Editor by following these steps:
  1. Make sure your project is open in Visual Studio.
  2. Right-click the .edmx file in Solution Explorer and select Open With...
  3. Select XML Editor and click OK.









Friday, February 25, 2011

What Is SilverLight?

Definition:-       


               Silverlight is a web based technology, launched by Microsoft in April 2007. Silverlight is considered as a competitor to Adobes Flash. Silverlight applications are delivered to browsers in a text-based markup language called XAML. One important difference between Flash and XAML is, Flash is a compiled application where as XAML is text based. Search engines can analyze and index such content, which is a huge benefit for webmasters.

                      For regular internet users, Silverlight is a browser plug-in that supports video, audio and animations.For web developers, Silverlight offers much more. Silverlight supports video and audio files without need of much programming. It allows them to handle events from web pages (like handle start/end of video playing etc) 



Difference Between Silverlight And WCF:-


                      Silverlight is a Microsoft technology, competing with Adobes Flash and is meant for developing rich browser based internet applications.

                      WPF is a Microsoft technology meant for developing enhanced graphics applications for desktop platform. In addition, WPF applications can be hosted on web browsers which offers rich graphics features for web applications. 





Tools For SliverLight:-


1. Microsoft Expression Studio - this tool is meant for web designers to create rich visual elements for Silverlight applications. Expression Studio is recommended for web designers who create rich internet applications with enhanced visual content and graphics. There are several features provided for creating enhanced graphics elements with lot of options to pick color, font etc.

2. Microsoft Visual Studio - this is the integrated development environment from Microsoft to develop .NET applications. Programmers can use Visual Studio to develop Silverlight applications which require programming. Visual Studio allows programmers to develop sophisticated Silverlight applications in any .NET language (like C#, VB.NET etc)

Wednesday, February 23, 2011

How to Insert Data CSV File to DataBase(Usign Bulk Copy)

Try This One:-

(SqlConnection cn = new SqlConnection
ConfigurationManager
.ConnectionStrings["ConnectionName"].ConnectionString);
cn.Open();
SqlBulkCopy copy = new SqlBulkCopy(cn);
copy.DestinationTableName = "Table Name";
//Dt Is DataTable
copy.WriteToServer(dt);

Wednesday, February 16, 2011

Web Counter Code In Html And JavaScript


Paste This Where u Need Counter

<a href="A1" title="HTML hit counter - Quick-counter.net"><img src="A2" alt="HTML hit counter - Quick-counter.net" border="0" /></a>


Where A1=Your Site Url Like http://www.google.com
And A2=Your Site Url With Page Name Like http://www.Google.com/Index.html

Saturday, February 12, 2011

Disable TextBox on Click CheckBox Using Java Script

Try This:-

function DisableTxt(txt,chk)
{
if(document.getElementById(chk).checked==true)
{
document.getElementById(txt).value=0;
document.getElementById(txt).disabled=true;
}
else
{
document.getElementById(txt).disabled=false;
}
}

Numeric Validation Using Java Script

Try This:-

function Numeric(Id)
{
If(IsNaN(Id.Value))
{
alert('only Numeric');
}
}