Declared accessibility | Meaning |
---|---|
public | Access is not restricted. |
protected | Access is limited to the containing class or types derived from the containing class. |
internal | Access is limited to the current assembly. |
protected internal | Access is limited to the current assembly or types derived from the containing class. |
private | Access is limited to the containing type. |
tutorials, tips and tricks to design a Windows Phone,Windows Store ,UWP,XAML ,.Net Application , Micrsoft Interview Question
Friday, November 11, 2011
Access modifier Accessibility Levels
Thursday, September 29, 2011
Option changes event
<
head><
style>.important
{ background-color:yellow; } .sorta-important { background-color:lightyellow; }</
style> <title>Untitled Page</title></
head><
body><
select onchange="this.className=this.options[this.selectedIndex].className" class="important"> <option class="important" selected="selected">Item 1</option> <option class="sorta-important">Item 2</option> </select></
body></
html>Saturday, September 17, 2011
ASP.NET TIPS: SENDING EMAIL USING ASP.NET (GMAIL OR YOUR SERVER)
Monday, September 12, 2011
Reset Controls Value using Asp.net / Javascript / J query
Reset Controls Value using Asp.net / Javascript / J query
Asp.net:
Dynamicaly you have to add controls means you don't know controls id so we can find control type in particular page after we can reset the page if your using C#.net coding mean page will refersh ,or if you are using javascript /j query means page not refresh
C#.net Coding:
protected void Button1_Click(object sender, EventArgs e)
{
ResetControl(this);
}
public void ResetControl(Control Parent)
{
foreach (Control c in Parent.Controls)
{
switch (c.GetType().ToString())
{
case "System.Web.UI.WebControls.TextBox":
((TextBox)c).Text = "";
break;
case "System.Web.UI.WebControls.CheckBox":
((CheckBox)c).Checked = false;
break;
case "System.Web.UI.WebControls.RadioButton":
((RadioButton)c).Checked = false;
break;
}
}
}
Javascript:
You can add client event in button .
<script language="javascript" type='text/javascript'>
function CLSEvent()
{
for (i=0; i<document.forms[0].length; i++)
{
doc = document.forms[0].elements[i];
switch (doc.type)
{
case "text" :
doc.value = "";
break;
case "checkbox" :
doc.checked = false;
break;
case "radio" :
doc.checked = false;
break;
case "select-one" :
doc.options[doc.selectedIndex].selected = false;
break;
case "select-multiple" :
while (doc.selectedIndex != -1)
{
indx = doc.selectedIndex;
doc.options[indx].selected = false;
}
doc.selected = false;
break;
default :
break;
}
}
}
</script>
JQuery:
function clear_form_elements(ele) {
case 'password':
case 'select-multiple':
case 'select-one':
case 'text':
case 'textarea':
$(this).val('');
break;
case 'checkbox':
case 'radio':
this.checked = false;
}
});
}
Saturday, September 3, 2011
Doubt on Indexer in C Sharp
I have doubt in indexer in c sharp. Can you explain me the
uses of indexer and example program with and without indexer. That
must be same program. Also need any real time example of indexer.
With Thanks & Regards,
J.Harishankaran
Mobile: 9677357493
Wednesday, August 31, 2011
Delegate-Lambda Expression (=>):
Lambda Expression (=>):
A lambda expression is an unnamed method written in place of a delegate instance.
The compiler immediately converts the lambda expression to either
- Delegate Instance
- Unmanaged Method
- Lambda Expression it introduced in C# 3.0
Below is delegate method declaration
public delegate int AddTwoNumberDel(int fvalue, int svalue);
We can use lambda expression
AddTwoNumberDel AT = (a, b) => a + b;
int result= AT(1,2);
MessageBox.Show(result.ToString());
Before that what we used Please check this url
http://jsdotnetsupport.blogspot.com/2011/08/beginner-delegate-program.html
What is Syntax in Lambda Expression?:
A lambda expression has the following form:
(parameters) => expression-or-statement-block
(a, b) => a + b; this program
(a, b) èParameter
a+b è Expression /statement block
=> è Lambda Expression
You can write Following format also
(a, b) =>{ return a + b }
Func ,Action Keyword:
Lambda Expression mostly used Func and Action Keyword
- Func Keyword is one of the generic Delegate
Example 1:
Func<int, int,string> Add = (fvalue, svalue) => (fvalue + svalue).ToString();
MessageBox.Show(Add(3, 5)); // outPut 8
Example 2:
Func<int, int, int> Add = (fvalue, svalue) => fvalue + svalue;
MessageBox.Show(Add(3, 5).ToString()); // outPut 8
Above program how its working ?
Func è Func is Keyword
Func<int, int,string> è first Two type is parameter ,Last type is return type
Add è Add is Method Name
(fvalue, svalue èParameter
(fvalue + svalue).ToString(); è Statement
Other feature:
- You can access outer variable also
Ex:
Int value=50;
Func<int, int, int> Add = (fvalue, svalue) => fvalue + svalue+ value;
MessageBox.Show(Add(3, 5).ToString()); // outPut 58
Question ?
Int value=50;
Func<int, int, int> Add = (fvalue, svalue) => fvalue + svalue+ value;
Int value=100;
MessageBox.Show(Add(3, 5).ToString());
Int value=200;
Post your Answers ….Get Special Gift …. To Bloger…..
Action Keyword:
Action Type same like Func method but The Action type receives parameters but does not return a parameter. The Func type, however, receives parameters and also returns a result value. The difference is that an Action never returns anything, while the Func always returns something. An Action is a void-style method in the C# language
Example:
using System;
class Program
{
static void Main()
{
// Example Action instances.
// ... First example uses one parameter.
// ... Second example uses two parameters.
// ... Third example uses no parameter.
// ... None have results.
Action<int> example1 =
(int x) => MessageBox.Show("Write {0}", x);
Action<int, int> example2 =
(x, y) => MessageBox.Show ("Write {0} and {1}", x, y);
Action example3 =
() => MessageBox.Show ("Done");
// Call the anonymous methods. Or example1(1)
example1.Invoke(1);
example2.Invoke(2, 3);
example3.Invoke();
}
}
Output
Write 1
Write 2 and 3
Done
Thursday, August 25, 2011
doubt...User Controls VS Custom Controls
What are user controls?
- User controls are custom,
- reusable controls,
- Microsoft offer an easy way to partition and reuse common user interfaces across ASP.NET Web applications
<%@ Register TagPrefix="UC" TagName="TestControl" Src="test.ascx" %>
and add control
<html> <body> <form runat="server"> <UC:TestControl id="Test1" runat="server"/> </form> </body> </html>How to add RunTime:// Load the control by calling LoadControl on the page class. Control c1 = LoadControl("test.ascx"); // Add the loaded control in the page controls collection. Page.Controls.Add(c1);What are custom controls?
Custom controls are compiled code components that execute on the server,expose the object model,and render markup text,such as HTML or XML, as a normal Web Form or user control does.How to create Custom control:Ctrl+Shift+A=> Add class library=>render control => excute programUser Control vs Custom Control:
Factors | User control | Custom control |
Deployment | Designed for single-application scenarios | Designed so that it can be used by more than one application |
Creation | Creation is similar to the way Web Forms pages are created; well-suited for rapid application development (RAD) | Writing involves lots of code because there is no designer support |
Content | A much better choice when you need static content within a fixed layout, for example, when you make headers and footers | More suited for when an application requires dynamic content to be displayed; can be reused across an application, for example, for a data bound table control with dynamic rows |
Design | Writing doesn't require much application designing because they are authored at design time and mostly contain static data | Writing from scratch requires a good understanding of the control's life cycle and the order in which events execute, which is normally taken care of in user controls |
What is the Difference between user control & custom control in asp.net.....Please give me some example......
Wednesday, August 24, 2011
Runtime Assign Method using Delegate
Writing Plug-in Methods with Delegates
A delegate variable is assigned a method dynamically. This is useful for writing plug-
in methods. In this example, we have a utility method named Add,Sub that applies
a NumberOper . The NumberOper method has a delegate
parameter,