




protected void Page_Load(object sender, EventArgs e)
{
Menu myMenu = new Menu();
this.form1.Controls.Add(myMenu);
MenuItem mnItem = new MenuItem("Dyamnic Menu");
myMenu.Items.Add(mnItem);
MenuItem menuNodeChild = new MenuItem("Xploredotnet");
mnItem.ChildItems.Add(menuNodeChild);
menuNodeChild.NavigateUrl = "http://www.Xploredotnet.com";
menuNodeChild = new MenuItem("ASP.NET");
mnItem.ChildItems.Add(menuNodeChild);
menuNodeChild.NavigateUrl = "http://www.asp.net";
myMenu.Orientation = Orientation.Horizontal;
//myMenu .Orientation = Orientation.Vertical;
}
protected void Page_Load(object sender, EventArgs e)
{
Menu myMenu = new Menu();
this.form1.Controls.Add(myMenu);
MenuItem mnItem = new MenuItem("test");
myMenu.Items.Add(mnItem);
myMenu.Orientation = Orientation.Horizontal;
//myMenu .Orientation = Orientation.Vertical;
}
Try it out! Simply send your search query by SMS to 9-77-33-00000 and it will send back results by SMS immediately.
For More Details
Visual Studio 2010 and the .NET Framework 4.0 mark the next generation of developer tools from
Microsoft. Designed to address the latest needs of developers,
Visual Studio delivers key innovations in the following pillars:
<script type="text/javascript" language="javascript">
history.go(1);
</script>
<asp:EditCommandColumn HeaderText="Edit" HeaderStyle-BackColor="#efeded"
CancelText="<img src='Images/icon_cancel.gif' alt='Cancel' style='border:0px' />"
EditText="<img src='Images/icon_edit.gif' style='border:0px' alt='Edit'/>"
UpdateText="<img src='Images/icon_save.gif' alt='Update' style='border:0px' />">
</asp:EditCommandColumn>
protected void dgAnnouncement_ItemCommand(object source, DataGridCommandEventArgs e)
{
switch(e.CommandName)
{
case "Edit":
dg.EditItemIndex = e.Item.ItemIndex;
.
.
fillurDataGrid
.
.
TextBox txtSub1 = (TextBox) dg.Items[e.Item.ItemIndex].Cells[0].FindControl("txtSubject");
// "Control differ according to the control you used within the DataGrid Column Here me used TextBox"
// "Cells[0] --> "Position Of The Column In The DataGrid"
// "FindControl("txtSubject") --> Control Id Which Within the Particular Cell
txtSub1.Focus();
}
}
Data Type | Min Value | Max Value | Storage Size |
tinyint | 0 | 255 | 1 byte |
smallint | -2^15 (-32,768) | 2^15 - 1 (32,767) | 2 bytes |
int | -2^31 (-2,147,483,648) | 2^31 - 1 (2,147,483,647) | 4 bytes |
bigint | -2^63 (-9,223,372,036,854,775,808) | 2^63 - 1 (9,223,372,036,854,775,807) | 8 bytes |
int i = 0;
while (i <= datatableid.Rows.Count - 1)
{
if (datatableid.Rows[i]["ColumnName"].ToString().Trim() == string.Empty)
{
datatableid.Rows.RemoveAt(i);
}
else
{
i += 1;
}
}
datagridname.Items.Count
Items
Gets a collection of DataGridItem objects that represent the individual items in the DataGrid control
COALESCE ( expression [ ,...n ] )
Example :
SELECT COALESCE(FieldName,'0.00') FROM TableName;
If The Specified Field have null value it will be replace by 0.00 in the Result.
It's equivalent to Oracle NVL.
function maxLengthPaste(field,maxChars)
{
event.returnValue=false;
if((field.value.length + window.clipboardData.getData("Text").length) > maxChars)
{
return false;
}
event.returnValue=true;
}
Use OnPaste Went To Call This Function
onpaste="return maxLengthPaste(this,500)"
This Code Has Been Post By The Viewer As Comment
function clrCtrls()
{ function addItem()
{
var lst = document.getElementById('lstbox'); // listbox control id
var newItem = prompt("Enter New Item","Enter Value Here");
//Option object is created for every option in a selection
//new Option([text[, value[, defaultSelected[, selected]]]]) // Syntax
if(newItem == null)
{
return false;
}
else
{
lst.options[lst.length] = new Option(newItem,newItem,false,false);
return false;
}
}
Edit Item To ListBox:
function editItem()
{
var lst = document.getElementById('lstbox'); // listbox control id
var selVal = lst.value;
if(selVal != "")
{
var newItem = prompt("Enter New Item",selVal);
if(newItem == null)
{
return false;
}
else
{
lst.options[lst.selectedIndex] = new Option(newItem,newItem,false,false);
return false;
}
}
else
{
alert('Select Item From The List To Edit ');
}
}
Remove Item For The Listbox
function rmItem()
{
var lst = document.getElementById('lstbox');// listbox control id
var selVal = lst.value;
if(selVal != "")
{
var msg = confirm("Do You Want To Remove ( "+selVal+" ) From The List");
if(msg == true)
{
lst.options[lst.selectedIndex] = null;
}
}
else
{
alert('Select Item To Remove From The List');
}
return false;
}
Today I had come across two articles and I feel that its good and all the programmers should read this articles.I like to share this for my blog readers.I'm posting the abstract here, so through the orginal articles.
Top 5 Attributes of Highly Effective Programmers
The most important quality of a developer: Self-criticism
"Don't just implement the first design you come out with, but try and refine looking at it from different angles before to start writing code.
public class Sort
{
public static void Main()
{
int[] iArr = { 9, 4, 2, 7, 6, 1, 0, 5, 3, 8 };
int i=0, j, temp;
for (i = 0; i < iArr.Length; i++)
{
for (j = i + 1; j < iArr.Length; j++)
{
if (iArr[i] < iArr[j]) // Descending
{
temp = iArr[i];
iArr[i] = iArr[j];
iArr[j] = temp;
}
} Console.WriteLine("iArr["+i+"] =>" + "{0}", iArr[i]);
}
Console.ReadLine();
}
}
Program Demo
<html>
<head>
<title>Capture Mouse Click Event</title>
<script language="javascript">
function noLeftClick()
{
switch (event.button)
{
case 1:
alert('You Clicked Left-Click ');
break;
case 2:
alert('You Clicked Right-Click.');
break;
}
}
document.onmousedown=noLeftClick
</script>
</head>
<body>
<h5>Click Any Were Within Browser</h3>
</body>
</html>
TypeDefault Value
bool false
int 0
float 0
string null
char '\0'
ReferenceType null
Internet Explorer 8 takes the Web experience beyond the page and introduces a new way to seamlessly experience the power of the Web whether you are a Web developer writing to standards, or an end user discovering a new online service. This beta release is available to everyone, but is primarily for Web developers and designers to test the new tools, layout engine, and programming enhancements.
Program To Select Row In DataGrid Or Gridview Using JavaScript,Have To Use TemplateColumn,AutoGenerateColumns="false"
// JScript File JSdg.js
function rowBind()
{
var navRoot,node,dgRowid = null,tBody,rwVal;
var Prev = null,Curr = null;
if(document.all && document.getElementById)
{
navRoot = document.getElementById('dg');
// Can Be Used For Both DataGrid & GridView,
//Have To Give The Cleint ControlId.
if(navRoot != null)
{
tBody = navRoot.childNodes[0];
for(i=0;i<tBody.childNodes.length;i++)
{
node = tBody.childNodes[i];
if(node.tagName == "TR")
{
node.onmousedown = function()
{
dtRowid = this.rowIndex;
rVal = dtRowid+2;
if(dtRowid < 8)
{
rwVal = 'dg$ctl0'+ rVal+'$txtAuId';
}
else
{
rwVal = 'dg$ctl'+rVal+'$txtAuId';
}
var ctrl1 = document.getElementById(rwVal);
if(Prev != null)
{
node.parentElement.children[Prev].style.background = "#FFFFFF";
}
Curr = this.rowIndex;
if(Curr != null)
{
node.parentElement.children[Curr].style.background = "#D8E8FF";
Prev = Curr;
}
alert(ctrl1.value);
}
}
}
}
}
}
CodeBehind
SqlConnection Con = new SqlConnection(@"SERVER=YourSERVERNAME;DATABASE=PUBS;UID=sa;PWD=sa;");
SqlDataAdapter Da = new SqlDataAdapter();
DataSet Ds = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
Da = new SqlDataAdapter("Select * from Authors", Con);
Da.Fill(Ds);
dg.DataSource = Ds;
dg.DataBind();
}
Inline
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="custDG.aspx.cs"
Inherits="Default3" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>Custom DataGrid</title>
<script type="text/javascript" language="javascript"
src="JavaScript/JSdg.js"></script>
</head>
<body onload="rowBind();">
<form id="form1" runat="server">
<div>
<asp:DataGrid ID="dg" runat="server" AutoGenerateColumns="false" ShowHeader="false">
<Columns>
<asp:TemplateColumn>
<ItemTemplate>
<asp:TextBox ID="txtAuId" ReadOnly="true" runat="server"
Text='<%# Bind("au_id") %>'
Style="background-color: Transparent; border: 0px;">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn>
<ItemTemplate>
<asp:TextBox ID="txtAuName" ReadOnly="true" runat="server"
Text='<%# Bind("au_lname") %>'
Style="background-color: Transparent; border: 0px;">
</asp:TextBox>
</ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
</div>
</form>
</body>
</html>
Program To Move Item Between ListBox (Select/Deselect All, Move Single Item, MultiSelect)
// JScript File(JSList.js)
var srclb,destlb;
var Flag ;
function moveAll(evt)
{
if(evt.id == 'btnSel' || evt.id == 'btnADitem')
{
srclb = document.getElementById('lboxSource');
destlb =document.getElementById('lboxdest');
}
else if(evt.id == 'btnDesel' || evt.id == 'btnRMitem')
{
srclb = document.getElementById('lboxdest');
destlb =document.getElementById('lboxSource');
}
if(srclb != null && destlb != null)
{
Flag = true;
while(Flag)
{
Flag = false;
for(var i=0;i<srclb.length;i++)
{
if(evt.id == 'btnADitem' || evt.id == 'btnRMitem')
{
if(srclb[i].selected)
{
exChange(i);
}
}
else if(evt.id == 'btnSel' || evt.id == 'btnDesel')
{
exChange(i);
}
}
}
}
}
function exChange(iVal)
{
destlb.appendChild(srclb[iVal].cloneNode(true));
srclb.removeChild(srclb[iVal]);
Flag = true;
}
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="ListBox.aspx.cs"
Inherits="ListBox" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>ListBox</title>
<script type="text/javascript" language="javascript" src="JavaScript/JSList.js"></script>
</head>
<body>
<form id="form1" runat="server">
<div>
<table>
<tr>
<td>
<asp:ListBox ID="lboxSource" SelectionMode="Multiple"
runat="server" Height="122px" Width="45px">
<asp:ListItem>A</asp:ListItem>
<asp:ListItem>B</asp:ListItem>
<asp:ListItem>C</asp:ListItem>
<asp:ListItem>D</asp:ListItem>
<asp:ListItem>E</asp:ListItem>
<asp:ListItem>F</asp:ListItem>
</asp:ListBox>
</td>
<td style="width: 31px">
<input id="btnDesel" title="DeselectAll" type="button"
style=" position:relative; left: 3px; width: 27px; top: 88px; height: 27px;"
onclick="moveAll(this);" value="««" />
<input id="btnRMitem" title="Remove Item" type="button"
style=" position:relative; left: 3px; width: 27px; top: 35px; height: 25px;"
onclick="moveAll(this);" value="«" />
<input id="btnADitem" title="Add Item" type="button"
style=" position:relative; left: 3px; width: 26px; top: -23px; height: 29px;"
onclick="moveAll(this);" value="»" />
<input id="btnSel" title="SelectAll" type="button"
style=" position:relative; left: 3px; width: 25px; top: -83px; height: 28px;"
onclick="moveAll(this);" value="»»" />
</td>
<td>
<asp:ListBox ID="lboxDest" SelectionMode="Multiple"
runat="server" Height="122px" Width="45px"></asp:ListBox>
</td>
</tr>
</table>
</div>
</form>
</body>
</html>
public partial class GridView : System.Web.UI.Page
{
SqlConnection Con = new SqlConnection(@"Server=yourservername;Database=pubs;uid=userid;password=pwd;");
SqlDataAdapter da = new SqlDataAdapter();
DataTable dt = new DataTable();
protected void Page_Load(object sender, EventArgs e)
{
gv.DataSource = GetData();
gv.DataBind();
}public DataTable GetData()
{
da = new SqlDataAdapter("Select * from authors", Con);
da.Fill(dt);
return dt;
}protected void gv_Sorting(object sender, GridViewSortEventArgs e)
{
string stExp = e.SortExpression;
string stDir = string.Empty;
if (StDir == SortDirection.Ascending)
{
StDir = SortDirection.Descending;
stDir= "DESC";
}
else
{
StDir = SortDirection.Ascending;
stDir="ASC";
}
DataTable dt = GetData();
DataView dv = new DataView(dt);
dv.Sort = e.SortExpression + " " + stDir;
gv.DataSource = dv;
gv.DataBind();
}
public SortDirection StDir
{
get
{
if (ViewState["sortDirection"] == null)
{
ViewState["sortDirection"] = SortDirection.Ascending;
}return (SortDirection)ViewState["sortDirection"];
}
set
{
ViewState["sortDirection"] = value;
}
}
}
STEP 1 :
Start - > Microsoft Visual Studio 2005 - > Create Project - >New Project DialogBox - >Select
Class Library (Visual C#) add code in Your class file then complie it.
STEP 2:
Start - > Microsoft Visual Studio 2005 - > Visual Studio Tools -> Visual Studio 2005
Command Prompt
move on to project folder location
For Example:
If You Create A Project By Name Example, Your Project Saved in the following location
E:\Example\Example\bin\Debug> ,in Visual Studio 2005 Command Prompt type the following
E:>Cd E:\Example\Example\bin\Debug
create shared name file for your dll by typing the follwing line
E:\Example\Example\bin\Debug> sn -k userdefinedname.key
Example=E:\Example\Example\bin\Debug> sn -k Example.key
The Key Will Be Created Within Debug Folder in the name Example.key
STEP 3:
Goto project solution properties
Click "Signing" Tab (First From Buttom).
Check Sign the assembly
Choose a Strong Name Key File dropdown , then select browse "Example.key", after going to
Debug Folder,in the Select File Dialog Select All Files(File TYpe).
save and then Compile the project
STEP 4:
Start - > Microsoft Visual Studio 2005 - > Visual Studio Tools -> Visual Studio 2005
Command Prompt Example=E:\Example\Example\bin\Debug> gacutil /i .dll
STEP 5 :
After hosting the assembly just go to WINNT\Assembly folder and you will find your
assembly listed there
Stored procedures have a segment of code which contains declarative or procedural SQL statement. A stored procedure is resided in the catalog of the database, we can invoke (call) it from a program, stored procedure or even from a trigger.
Stored Procedure contains sql statements like insert, update and delete. In addition stored procedure supports If and while statements.
Advantages:
Once we created Stored Procedure then it can be reused over and over again by multiple applications.
Stored Procedure increase the performance of the application because once it compiled successfully then it’s stored in database catalog. When applications call them, they generally execute faster when compared with un-compiled SQL Statements which are sent from the applications.
Network Traffic between application server and database server is also signification reduced when compared with un-compiled SQL Statements which are sent from the applications.
Syntaxowner:
Is the name of the user ID that owns the stored procedure. owner must be either the name of the current user or the name of a role that a current user is a member.
OUTPUT:
Indicates that the parameter is a return parameter.
;number:
Is an optional integer used to group procedures of the same name so they can be dropped together with a single DROP PROCEDURE statement.