Sep 28, 2011

How to Get and change style of all dropdown in Jquery

 <script type="text/javascript">

  $("select").focusin(function() {
   jQuery(this).closest("table").css("height","+35"); 
    });

 $("select").focusout(function() {
 jQuery(this).closest("table").css("height","auto");      
    });
   
</script>

Sep 25, 2011

How to add hyperlink in Grid View with DataBinder.Eval()


 <asp:datagrid id="Datagrid3" runat="server" AutoGenerateColumns="False" BorderColor="black" 
       HeaderStyle-CssClass="tableHeader" ItemStyle-CssClass= "tableItem">
        <Columns>
                  <asp:TemplateColumn HeaderText="Order">
                      <ItemTemplate>
                         <asp:Hyperlink runat= "server" Text='<%# DataBinder.Eval(Container.DataItem,"ProductName").tostring%>' 
                          NavigateUrl='<%# "page.aspx?Name=" & DataBinder.Eval (Container.DataItem,"ProductName").tostring & _  
                          "&ProductID=" & DataBinder.Eval(Container.DataItem,"ProductID").tostring %>' ID="ProductName"/>  
  
                       </ItemTemplate>
                     </asp:TemplateColumn>                                    
         </Columns>
</asp:datagrid>

Sep 20, 2011

Up and Down List Box Item Java Script In ASP.NET

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
    <title>Untitled Page</title>

</head>
<body>
    <form id="form1" runat="server">
    <input type="button" value="Up"onclick="moveUp(this.form['_lb2']);" />
    <asp:ListBox ID="_lb2" name="_lb2" runat="server" Height="100px" Width="170px">
        <asp:ListItem>Data1</asp:ListItem>
        <asp:ListItem>Data2</asp:ListItem>
        <asp:ListItem>Data3</asp:ListItem>
        <asp:ListItem>Data4</asp:ListItem>
    </asp:ListBox>
  <input type="button" value="Down"onclick="moveDown(this.form['_lb2']);" />
    <div>
        <br />
        </div>
    </form>
</body>


<script type="text/javascript">

function moveUp(sel)
{
  var idx = sel.selectedIndex;
  var opt;

  // Only move up if not first
  if (idx > 0)
  {
    opt = sel.options[idx];
    sel.insertBefore(opt, sel.options[--idx]);
  }
}

function moveDown(sel)
{
  var idx = sel.selectedIndex;
  var opt;

  // Only move up if not first
  
  if (idx < sel.length-1)
  {
    opt = sel.options[idx];  
    sel.insertBefore(sel.options[++idx],opt);
  }
}

</script>
</html>

How to use XML To Save the data in Store Procedure in MS SQL 2005/2008


DECLARE @XMLDOC VARCHAR(MAX)
DECLARE @xml_hndl INT



SET @XMLDOC='<?xml version="1.0" encoding="ISO-8859-1"?>

<SBU><row><SBU_code>QQQ</SBU_code><SbuOrder></SbuOrder></row><row><SBU_code>WW</SBU_code><SbuOrder></SbuOrder></row><row><SBU_code>zz</SBU_code><SbuOrder></SbuOrder></row><row><SBU_code>PS</SBU_code><SbuOrder>1</SbuOrder></row><row><SBU_code>IS</SBU_code><SbuOrder>2</SbuOrder></row><row><SBU_code>CP</SBU_code><SbuOrder>3</SbuOrder></row><row><SBU_code>DG</SBU_code><SbuOrder>4</SbuOrder></row><row><SBU_code>RG</SBU_code><SbuOrder>5</SbuOrder></row><row><SBU_code>CT</SBU_code><SbuOrder>6</SbuOrder></row><row><SBU_code>test</SBU_code><SbuOrder>7</SbuOrder></row><row><SBU_code>CC</SBU_code><SbuOrder>8</SbuOrder></row><row><SBU_code>PW</SBU_code><SbuOrder>9</SbuOrder></row><row><SBU_code>RR</SBU_code><SbuOrder>10</SbuOrder></row></SBU>'



EXEC Sp_xml_preparedocument  @xml_hndl OUTPUT,  @XMLDOC


--Below Read the whole data and Insert it into table --


SELECT * FROM   OPENXML(@xml_hndl, '/SBU/row', 1)
          
WITH ( sbu_code VARCHAR(MAX) 'SBU_code',
                 
sbuorder VARCHAR(MAX) 'SbuOrder' )


--Remove document ----
EXEC sp_xml_removedocument @xml_hndl                  

Sep 16, 2011

Here's a link to an article about some free .NET profilers, and paid ones too ,which help You to increase performance

Profiling is an important part of your software development process and allows you to determine improvements in your applications. In simple words, it is tuning your application to increase its performance. Here are some free and paid .NET profilers to do the job for you
Free
EQATEC v3.0 – An easy to use code profiler to spot your app's slow code. Profiles only methods as of this writing. You can use it freely for non-commercial use. Check the pricing page for the free license
CLR Profiler for .NET Framework – Free memory allocation profiler which works for .NET 2.0 and 3.5 as well
slimTune - Free profiler and performance analysis/tuning tool for .NET based applications
Commercial
Visual Studio Team System Profiler – Ships with Visual Studio Team System (Developer and Suite) for finding performance issues in your native, managed or ASP.NET applications
ANTS Profiler v5.1 – Highly recommended profiler to identify performance bottlenecks and optimize performance
dotTrace 3.1 – Performance and memory profiler for .NET
MemProfiler 3.5 - powerful tool for finding memory leaks and optimizing the memory usage in programs written in C#, VB.NET or any other .NET Language
AQTime 6 - performance profiling and memory and resource debugging toolset for .NET applications

Sep 9, 2011

How to validate validation in cliient side in java script

function chkValidation(nextTab)
{
if (tab.name=='EmployeeDetails')
{
var btnSave = document.getElementById("<%=btnSave.clientID%>");
WebForm_DoPostBackWithOptions(new WebForm_PostBackOptions('ctl00$ContentPlaceHolder1$btnSave', '', true, '', '', false, false));
if (Page_ClientValidate()==false)
return false;
}
else
{
tab.name = nextTab;
}
}

How to check user validation in java script


{

WebForm_DoPostBackWithOptions(


}
if (tab.name=='EmployeeDetails') var btnSave = document.getElementById("<%=btnSave.clientID%>"); new WebForm_PostBackOptions('ctl00$ContentPlaceHolder1$btnSave', '', true, '', '', false, false));if (Page_ClientValidate()==false)return false;

Sep 5, 2011

Export in DevexGrid

Visit the following link...

http://demos.devexpress.com/aspxgridviewdemos/Exporting/ExportSelected.aspx

How to use filter expression to return an array of DataRow objects.

Private Sub GetRowsByFilter()

    Dim table As DataTable = DataSet1.Tables("Orders")

    ' Presuming the DataTable has a column named Date.
    Dim expression As String
    expression = "Date > #1/1/00#"
    Dim foundRows() As DataRow

    ' Use the Select method to find all rows matching the filter.
    foundRows = table.Select(expression)

    Dim i As Integer
    ' Print column 0 of each returned row.
    For i = 0 to foundRows.GetUpperBound(0)
       Console.WriteLine(foundRows(i)(0))
    Next i
End Sub
 
 
--------------------------------- OR ----------------------------------------
 
Protected Sub DDLCompany_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim ds As New DataSet
        ds = ViewState("ViewDDLMaster")

        ' Filter Division as per Company

        Dim tempDView As DataView
        tempDView = ds.Tables(1).DefaultView
        tempDView.RowFilter = "div_company ='" + DDLCompany.SelectedValue.Trim + "'"

        'GridView1.DataSource = tempDView.ToTable()
        'GridView1.DataBind()
        DDLDivision.DataSource = tempDView.Table
        DDLDivision.DataTextField = "div_desc"
        DDLDivision.DataValueField = "div_code"
        DDLDivision.DataBind()
        DDLDivision.Items.Insert(0, "Select")

    End Sub

What is the use of n-tier architecture and 3-tier architecture?

how to implement 3-tier architecture in asp.net using c#. 3-Tier architecture is also called layered architecture. Some people called it ...