Sharing knowledge in Project, Program, Portfolio Innovation Management (PPIM) and various Technology.
Monday, January 5, 2009
Using Filter Expressions with an SQL Data Source in ASP.NET VB 2008
If you use sqldatasource in your project. we can filter the dataset in c# coding itself.
Example1
If (Session("FiltExp") <> Nothing) Then
SqlDataSource1.FilterExpression = Session("FiltExp").ToString()
End If
Example2
SqlDataSource1.FilterExpression = "city='" & DropDownList1.SelectedValue & "'"
Example3
SqlDataSource1.FilterExpression = "BirthDate > #" + dt + "#"
Session("FiltExp") = "BirthDate > #" + dt + "#"
Hidden Features in C#
var @object = new object();
var @string = "";
var @if = IpsoFacto();
2) Aliased Generics.
using ASimpleName = Dictionary<string, Dictionary<string, List<string>>>;
Allows you to ASimpleName,instead of
Dictionary<string, Dictionary<string, List<string>>>;
Use it when you would use the same generic big long complex thing in a lot of places.
Thursday, January 1, 2009
Accessing server side event using Ajax 3.5 with Visual Studio 2008
Accessing server side event using Ajax 3.5 in visual studio 2008.
when we compare with earlier method,This may easy to write the code for developer.
step1 :
Include in your application system.web.extensions 3.5
Step 2:
In the script manager tag EnablePageMethods attribute make it true. it will help you to create method in the pagemethod class. Then only you can access the server event in the client side.
<asp:ScriptManager ID="ScriptManager1" EnablePageMethods="true" runat="server">
</asp:ScriptManager>
Step 3:
We should include the namespace over the server side method.[System.Web.Services.WebMethod].
Earlier we have used [Ajax.Ajaxmethod].
Example
[System.Web.Services.WebMethod]
public static string Message(string one,string two)
{
return one + two;
}
Client side. while calling the server side method. it will create two default methods. if it is succeed it will call OnGetMessageSuccess, and fails it will call OnGetMessageFailure.
Example
function GetCall()
{
PageMethods.Message("122","122",OnGetMessageSuccess, OnGetMessageFailure);
}
function OnGetMessageSuccess(result,userContext,methodName)
{
alert(result);
alert(userContext);
}
function OnGetMessageFailure(error,userContext,methodName)
{
alert(error.get_message());
}
Customizing "Start Page" in Visual Studio 2010
Thursday, October 30, 2008
Windows Workflow Foundation
Workflow is nothing but a Business Process also start with a need end with a fulfilled need.
now lets talk about Business Process.
Business Process.
Business process is a collection of activities.it will describe the start to end activity. The Business process is categrozied in to three types. The types are
1)Management Business process(Ex:Governence and Strategic Management)
2)Operation Business process(Ex:Manufactoring,Supply chain).
3)supporting Business Process(Ex:Accounting Recuriting).
Tuesday, October 14, 2008
Visual studio 2008 has a new style builder dialog
Tuesday, September 23, 2008
Monday, August 11, 2008
Reading and writing file in Table using binary
step 1:
Create table with the folowing column, The columns are content type, filename and filedata. if you want also create some additional columns.
for "filedata" column choose datatype called "image" in the datatype list.
Note:if you choose binary datatype instead of image. unable to insert large data in to the table.
writing file in to the table
step 2:
just convert your data file to binary format, After that do insert in to table.
step 3:
how to run exe file through javascript
<head>
<script language="javascript" type="text/javascript">
function runApp()
{s
var shell = new ActiveXObject("WScript.shell");
shell.run("notepad.exe ", 1, true);
}
</script>
</head>
<body>
<input type="button" name="button1" value="Run Notepad" onClick="runApp()" />
</body>
</html>
Monday, July 7, 2008
Dropdown validation using Javascript
Step 1:
function getcheckdrp()
{
var drp=document.getElementById("drpcheck");
if(drp=='[object]')
{
if(drp.selectedIndex==0)
{
alert("please select state");
return false;
}
}
}
step 2:
<asp:ListItem>----Select State----</asp:ListItem>
<asp:ListItem>Karnataka</asp:ListItem>
<asp:ListItem>Bangalore</asp:ListItem>
</asp:DropDownList>
<asp:Button ID="btncheckdrp" runat="server" />
step 3:
protected void Page_Load(object sender, EventArgs e)
{
btncheckdrp.Attributes.Add("onclick", "javascript:return getcheckdrp()");
}
Tuesday, June 24, 2008
How to Register User Controls and Custom Controls in Web.config
<?xml version="1.0"?>
<configuration>
<system.web>
<pages>
<controls>
<add tagPrefix="bala" src="~/Controls/Header.ascx" tagName="header"/>
<add tagPrefix="bala" src="~/Controls/Footer.ascx" tagName="footer"/>
<add tagPrefix="ControlVendor" assembly="ControlVendorAssembly"/>
</controls>
</pages>
</system.web>
</configuration>
<strong>Output:</strong>
<html>
<body>
<form id="form1" runat="server">
<bala:header ID="MyHeader" runat="server" />
</form>
</body>
</html>
Monday, June 9, 2008
Accordin Control using Dotnet
</asp:ScriptManager>
<asp:UpdatePanel ID="updatepanel1" runat="Server">
<ContentTemplate>
<table>
<tr>
<td>dsfsd</td>
</tr>
<tr>
<td>
<cc1:Accordion ID="accordin1" runat="server" RequireOpenedPane="false">
<Panes>
<cc1:AccordionPane id="accordinpane1" runat="server">
<Header>
<asp:Label ID="lbltext" runat="server" Text="bala"></asp:Label>
</Header>
<Content>
<asp:Label ID="Label1" runat="server" Text="bala1"></asp:Label>
<cc1:Accordion ID="accordin2" runat="server" RequireOpenedPane="false">
<Panes>
<cc1:AccordionPane ID="test" runat="server">
<header>
<asp:Label ID="lbltest1" runat="server" Text="testsdfsd"></asp:Label>
</header>
<Content>
<asp:Label ID="lbltest" runat="server" Text="test"></asp:Label>
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
</Content>
</cc1:AccordionPane>
</Panes>
</cc1:Accordion>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
How to select all checkbox when i select header checkbox in datagrid.
function checkall(obj)
{
var check=obj.checked;
var len=document.form1.elements.length;
for(i=0;i<len;i++)
{
if(document.form1.elements.item(i).type=="checkbox")
{
document.form1.elements.item(i).checked=check;
}
}
}
</script>
In .Aspx grid control..
<Columns>
<asp:TemplateColumn>
<HeaderTemplate>
<input type="checkbox" id="head" onclick="checkall(this)"/>
</HeaderTemplate>
</asp:TemplateColumn>
</Columns>
<Columns>
number validatuion in textbox using Javascript
{
var check=false;
var val=obj.value;
var s=new Array("0","1","2","3","4","5","6","7","8","9");
var len=val.length;
for(i=0;i<len;i++)
{
for(j=0;j<s.length;j++)
{
if(obj.value.charAt(i)==s[j])
{
check=false
break;
}
else
{
check=true
}
}
}
if(check==true)
{
obj.value="";
obj.focus();
alert("Please type valid number");
return false;
}
}
Note:Call using onkey up event in html..
<asp:TextBox ID="txtbox" runat="server" onkeyup="javascript:return typecheck(this)" ></asp:TextBox>
how to search textbox value in dropdownlist Using Javascript
<asp:DropDownList ID="drpt" runat="server">
<asp:ListItem Text="text">ss</asp:ListItem>
<asp:ListItem Text="text">ss1</asp:ListItem>
<asp:ListItem Text="text">ss2</asp:ListItem>
<asp:ListItem Text="text">ss3</asp:ListItem>
<script language="javascript">
function getValue(obj)
{
var d=obj.value;
var dro=document.getElementById("drpt");
var drplen=document.getElementById("drpt").options.length
var i;
for(i=0;i<drplen;i++)
{
if(document.getElementById("drpt").options[i].value==d)
{
document.getElementById("drpt").selectedIndex=i;
}
}
}
</asp:DropDownList>
</script>
Sunday, June 8, 2008
Adding rows in DataGrid
DataRow dr = dtg.NewRow();
dr["Item_ID"]="ItemID";
dr["Item_Name"]="Item Name";
dr["Item_Desc"]="Item Description";
dr["Item_Amount"]="$15.65";
dtg.Rows.Add(dr);
DataGrid1.DataSource = dtg;
It will work for windows.
If you use DataGrid in ASP then you will have to keep DataTable in Session:
DataTable dtg = new DataTable();
if (Session["SampleDataTable"]==null)
{
DataColumn dc;
dc = new DataColumn("Item_ID",System.Type.GetType("System.String"));
dtg.Columns.Add(dc);
dc = new DataColumn("Item_Name",System.Type.GetType("System.String"));
dtg.Columns.Add(dc);
dc = new DataColumn("Item_Desc",System.Type.GetType("System.String"));
dtg.Columns.Add(dc);
dc = new DataColumn("Item_Amount",System.Type.GetType("System.String"));
dtg.Columns.Add(dc);
}
else {dtg = (DataTable) Session["SampleDataTable"];}
DataRow dr = dtg.NewRow();
dr["Item_ID"]="ItemID";
dr["Item_Name"]="Item Name";
dr["Item_Desc"]="Item Description";
dr["Item_Amount"]="$15.35;
dtg.Rows.Add(dr);
DataGrid1.DataSource=dtg;
DataGrid1.PageSize+=1;
DataGrid1.DataBind();
Session["SampleDataTable"]=dtg;
Tuesday, June 3, 2008
Windows Communication Foundation (WCF) features
• Facilitates interoperability through WS-* standards
• WS-Trust. Uses the secure messaging mechanisms of WS-Security
• WS-SecureConversation
• WS-Federation
• WS-SecurityPolicy
• Confidentiality – keeping messages private
• Authentication – verifying claimed identity
• Uses transport-level protocol (like HTTPS); only point-to-point secure
• Uses WS-Security; less efficient but secure from end to end
• SOAP Message Security (OASIS)
Reliable Messaging
• Provides for SOAP messages what TCP provides for IP packets
• Ensures messages are exactly once
• Handles lost messages and duplicates
• End-to-end reliability (vs. transport reliability of TCP)
Queues
• Leverages Microsoft Message Queuing (MSMQ) as a transport
• Enables loosely coupled applications and disconnected operations
Transactions
• Takes advantage of System.Transactions in .NET 2.0
• Supports WS-AtomicTransaction
Compatibility
COM+
• Extend COM+ components as Web services
• Service derived from COM+ interface
COM
• Moniker support (GetObject) for usage of WCF services from COM-based applications
Debugging the wcf Service in client side
step1:
<compilation debug=true>
step2:
<servicedebug includeExceptionDetailInfaults="true"/>
Thursday, May 29, 2008
Syndication on WCF
Restart Http Service using Command prompt
step2: type "net start http"
step3: end



