var temp = document.getElementById("dvDiv").innerHTML;
document.getElementById("dvDiv").innerHTML = "<span style='verticle-align:middle;color:#FF5500;font-family:verdana;word-spacing:4px'><img src='../images/loading.gif' /><strong>wait...</strong></span>";
//Show loading message with image
var xmlhttp = GetXMLRequestObject();
var Rurl = "Page.aspx?qs=your query string here" ;
xmlhttp.open('POST', Rurl, true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.send(SomeId);
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4) {
var responseText = xmlhttp.responseText;
document.getElementById("dvDiv").innerHTML = responseText; //Show the response here
}
}
xmlhttp = null;
}
Wednesday, December 28, 2011
Ajax Page Response
Wednesday, December 7, 2011
Image with HomeURL
<img src="<%= YourProjectBase.YourConfigUtility.HomeURL %>yourfolder/images/<%# Eval("ImageName")%>.png" alt="" width="17" height="21" align="left" />
Friday, October 28, 2011
Get selected values of checkbox from GridView in ASP.NET
Private Function SelectedValues() As String
Dim strValues As String = ""
For i As Integer = 0 To GridView.Rows.Count - 1
Dim chkSelect As CheckBox
chkSelect = CType(gvClientContact.Rows(i).FindControl("chkSelect"), CheckBox)
If Not chkSelect Is Nothing Then
If chkSelect.Checked Then
strValues &= CStr(GridView.DataKeys(i).Values(0)) & ","
End If
End If10/09/2010
Next
Return strValues.Trim(CChar(","))
End Function
Wednesday, October 19, 2011
Circular matrix in vb.net
Dim c As Integer = 1
Dim i, j, k, n, x As Integer
Dim m As Integer = 0
n = 5
x = n
Dim a(n, n) As Integer
While n >= 1
For k = 0 To n - 1
a(m, k + m) = c
c = c + 1
Next
For k = 1 To n - 1
a(k + m, n - 1 + m) = c
c = c + 1
Next
For k = n - 2 To 0 Step -1
a(n - 1 + m, k + m) = c
c = c + 1
Next
For k = n - 2 To 1 Step -1
a(k + m, m) = c
c = c + 1
Next
n = n - 2
m = m + 1
End While
Dim strB As New StringBuilder
strB.Append("<table border='1'>")
For i = 0 To x - 1
strB.Append("<tr>")
For j = 0 To x - 1
strB.Append("<td>")
strB.Append(a(i, j))
strB.Append("</td>")
Next
strB.Append("</tr>")
Next
strB.Append("</table>")
Response.Write(strB)
Friday, October 14, 2011
Get selected checkbox value of ASP.NET GRID VIEW using JavaScript
<script language="javascript" type="text/javascript">
function GetSelected(objchk, HId) {
var hdnIds = document.getElementById("<%= hdnIds.ClientId %>");
if (hdnIds.value.length == 0) {
hdnIds.value = ",";
}
if (objchk.checked == true) {
hdnIds.value = hdnIds.value + HId + ",";
}
else {
hdnIds.value = hdnIds.value.replace("," + HId + ",", ",")
}
}
</script>
'Bind this function like On GridView's RowDataBound Event.
Private Sub gv_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles gv.RowDataBound
Dim chkSelect As CheckBox = CType(e.Row.FindControl("chkSelect"), CheckBox)
If Not chkSelect Is Nothing Then
chkSelect.Attributes.Add("onclick", "GetSelected(this,'" & DataBinder.Eval(e.Row.DataItem, "HId").ToString() & "');")
End If
End Sub
'Now you have comma seperated values of HIds in hdnIds hidden field which you can use accordingly
Wednesday, October 12, 2011
Find post back control with JavaScript
<script language="javascript" type="text/javascript">
Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler);
Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler);
var PostBackCtrl;
function BeginRequestHandler(sender, e) {
PostBackCtrl = e.get_postBackElement();
}
function EndRequestHandler(sender, e) {
if (PostBackCtrl.id.toLowerCase().indexOf("yourcontrolname") > 0 ) {
//This is your control which made post back
//write your code here
}
}
</script>
Monday, October 10, 2011
SQL Code to generate properties for vb.net
/*
SQL Code to generate properties for vb.net
*/
Declare @TableName varchar(100)
Set @TableName ='TableName'
Declare @Column1 varchar(300),
@Datatype varchar(50),
@ActColumn1 varchar(300),
@FieldType varchar(50)
print '============================================================================================='
print '#Region "Fields" '
DECLARE get_Data CURSOR
FOR SELECT COLUMN_NAME ,DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName
ORDER BY ORDINAL_POSITION
OPEN get_Data
FETCH NEXT FROM get_Data into @Column1,@Datatype
WHILE @@FETCH_STATUS = 0
BEGIN
set @ActColumn1 = @Column1
if @Datatype = 'int'
Set @FieldType = 'Integer'
else if @Datatype = 'tinyint'
Set @FieldType = 'Int16'
else if @Datatype = 'float'
Set @FieldType = 'Double'
else if @Datatype = 'varchar' or @Datatype = 'text'
Set @FieldType = 'String'
else
Set @FieldType = @Datatype
print 'Private _' + @Column1 + ' as ' + @FieldType
FETCH NEXT FROM get_Data into @Column1,@Datatype
End
CLOSE get_Data
DEALLOCATE get_Data
print ' #End region'
print '============================================================================================='
print '============================================================================================='
print '#Region "Properties" '
DECLARE get_Data CURSOR FOR
SELECT COLUMN_NAME ,DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName
ORDER BY ORDINAL_POSITION
OPEN get_Data
FETCH NEXT FROM get_Data into @Column1,@Datatype
WHILE @@FETCH_STATUS = 0
BEGIN
set @ActColumn1 = @Column1
if @Datatype = 'int'
Set @FieldType = 'Integer'
else if @Datatype = 'tinyint'
Set @FieldType = 'Int16'
else if @Datatype = 'float'
Set @FieldType = 'Double'
else if @Datatype = 'varchar' or @Datatype = 'text'
Set @FieldType = 'String'
else
Set @FieldType = @Datatype
print 'public property ' + @Column1 + '() as ' + @FieldType
print 'Get'
print 'return _' + @ActColumn1
print ' End Get'
print 'Set(ByVal Value as '+ @FieldType +')'
print '_' + @ActColumn1 + ' = value'
print ' End Set'
print 'End Property'
FETCH NEXT FROM get_Data into @Column1,@Datatype
End
CLOSE get_Data
DEALLOCATE get_Data
print ' #End region'
print '============================================================================================='
print '============================================================================================='
print '#Region "Method" '
print ' Public Function InsertUpdate() As Integer
Dim db As Database = Nothing
Dim dbCommand As DbCommand = Nothing
Try
db = DatabaseFactory.CreateDatabase()
dbCommand = db.GetStoredProcCommand("'+Replace(@TableName,'_','')+'_InsertUpdate")'
DECLARE get_Data CURSOR FOR
SELECT COLUMN_NAME ,DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName
ORDER BY ORDINAL_POSITION
OPEN get_Data
FETCH NEXT FROM get_Data into @Column1,@Datatype
WHILE @@FETCH_STATUS = 0
BEGIN
set @ActColumn1 = @Column1
if @Datatype = 'int'
Set @FieldType = 'Int32'
else if @Datatype = 'tinyint'
Set @FieldType = 'Int16'
else if @Datatype = 'float'
Set @FieldType = 'Double'
else if @Datatype = 'varchar' or @Datatype = 'text'
Set @FieldType = 'String'
else
Set @FieldType = @Datatype
print ' db.AddInParameter(dbCommand, "@'+@Column1+'", DbType.'+@FieldType+', _'+@Column1+')'
FETCH NEXT FROM get_Data into @Column1,@Datatype
End
CLOSE get_Data
DEALLOCATE get_Data
print ''
print ' Dim returnValue As Integer = Convert.ToInt32(db.ExecuteScalar(dbCommand))
Return returnValue
Finally
BObase.DisposeOf(dbCommand)
BObase.DisposeOf(db)
End Try
End Function'
print 'Public Function View() As Boolean'
print ' Dim dt As DataTable = Me.SelectById()'
print ' If Not BObase.IsNothingOrEmpty(dt) Then'
print ' Dim dr As DataRow = dt.Rows(0)'
print ' BObase.SetDefaultValuesForDBNull(dr)'
print ' With Me'
DECLARE get_Data CURSOR
FOR SELECT COLUMN_NAME ,DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName
ORDER BY ORDINAL_POSITION
OPEN get_Data
FETCH NEXT FROM get_Data into @Column1,@Datatype
WHILE @@FETCH_STATUS = 0
BEGIN
print ' ._' + @Column1 + ' = dr("' + @Column1 + '")'
FETCH NEXT FROM get_Data into @Column1,@Datatype
End
CLOSE get_Data
DEALLOCATE get_Data
print ' End With'
print ' Return True'
print ' Else'
print ' Return False'
print ' End If'
print 'End Function'
print ' #End region'
print '============================================================================================='
print ' With objProperties'
DECLARE get_Data CURSOR
FOR SELECT COLUMN_NAME ,DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName
ORDER BY ORDINAL_POSITION
OPEN get_Data
FETCH NEXT FROM get_Data into @Column1,@Datatype
WHILE @@FETCH_STATUS = 0
BEGIN
set @ActColumn1 = @Column1
If @Datatype='int'
begin
set @Datatype='Integer'
set @ActColumn1= substring(@Column1,0,len(@Column1)+1)
set @Column1='lst' + substring(@Column1,0,len(@Column1)+1) + '.SelectedValue'
end
else if @Datatype='nvarchar'
begin
set @Datatype='String'
set @ActColumn1= substring(@Column1,0,len(@Column1)+1)
set @Column1='txt' + substring(@Column1,0,len(@Column1)+1) +'.text'
end
else if @Datatype='datetime'
begin
set @Datatype='String'
set @ActColumn1= substring(@Column1,0,len(@Column1)+1)
set @Column1='txt' + substring(@Column1,0,len(@Column1)+1) +'.text'
end
else if @Datatype='bit'
begin
set @Datatype='Boolean'
set @ActColumn1= substring(@Column1,0,len(@Column1)+1)
set @Column1='chk' + substring(@Column1,0,len(@Column1)+1) + '.checked'
end
else if @Datatype='decimal'
begin
set @Datatype='Double'
set @ActColumn1=substring(@Column1,0,len(@Column1)+1)
set @Column1='txt' +substring(@Column1,0,len(@Column1)+1) +'.text'
end
else if @Datatype='float'
begin
set @Datatype='Double'
set @ActColumn1=substring(@Column1,0,len(@Column1)+1)
set @Column1='txt' +substring(@Column1,0,len(@Column1)+1) +'.text'
end
print ' ' + @Column1 + ' = .' + @ActColumn1
FETCH NEXT FROM get_Data into @Column1,@Datatype
End
CLOSE get_Data
DEALLOCATE get_Data
print ' End With'
print '============================================================================================='
print ' With objProperties'
DECLARE get_Data CURSOR
FOR SELECT COLUMN_NAME ,DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName
ORDER BY ORDINAL_POSITION
OPEN get_Data
FETCH NEXT FROM get_Data into @Column1,@Datatype
WHILE @@FETCH_STATUS = 0
BEGIN
set @ActColumn1 = @Column1
If @Datatype='int'
begin
set @Datatype='Integer'
set @ActColumn1= substring(@Column1,0,len(@Column1)+1)
set @Column1='lst' + substring(@Column1,0,len(@Column1)+1) + '.SelectedValue'
end
else if @Datatype='nvarchar'
begin
set @Datatype='String'
set @ActColumn1= substring(@Column1,0,len(@Column1)+1)
set @Column1='txt' + substring(@Column1,0,len(@Column1)+1) +'.text'
end
else if @Datatype='datetime'
begin
set @Datatype='String'
set @ActColumn1= substring(@Column1,0,len(@Column1)+1)
set @Column1='txt' + substring(@Column1,0,len(@Column1)+1) +'.text'
end
else if @Datatype='bit'
begin
set @Datatype='Boolean'
set @ActColumn1= substring(@Column1,0,len(@Column1)+1)
set @Column1='chk' + substring(@Column1,0,len(@Column1)+1) + '.checked'
end
else if @Datatype='decimal'
begin
set @Datatype='Double'
set @ActColumn1=substring(@Column1,0,len(@Column1)+1)
set @Column1='txt' +substring(@Column1,0,len(@Column1)+1) +'.text'
end
else if @Datatype='float'
begin
set @Datatype='Double'
set @ActColumn1=substring(@Column1,0,len(@Column1)+1)
set @Column1='txt' +substring(@Column1,0,len(@Column1)+1) +'.text'
end
print ' .' + @ActColumn1 + ' = ' + @Column1
FETCH NEXT FROM get_Data into @Column1,@Datatype
End
CLOSE get_Data
DEALLOCATE get_Data
print ' End With'
print '============================================================================================='
print '============================================================================================='
print '#Region "Fields" '
DECLARE @strOutput varchar(Max)
SET @strOutput = 'public sub New ('
DECLARE get_Data CURSOR
FOR SELECT COLUMN_NAME ,DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName
ORDER BY ORDINAL_POSITION
OPEN get_Data
FETCH NEXT FROM get_Data into @Column1,@Datatype
WHILE @@FETCH_STATUS = 0
BEGIN
set @ActColumn1 = @Column1
if @Datatype = 'int'
Set @FieldType = 'Integer'
else if @Datatype = 'tinyint'
Set @FieldType = 'Int16'
else if @Datatype = 'float'
Set @FieldType = 'Double'
else if @Datatype = 'varchar' or @Datatype = 'text'
Set @FieldType = 'String'
else
Set @FieldType = @Datatype
SET @strOutput = @strOutput + @Column1 + ' as ' + @FieldType + ', '
FETCH NEXT FROM get_Data into @Column1,@Datatype
End
CLOSE get_Data
DEALLOCATE get_Data
PRINT @strOutput
print ' #End region'
print '============================================================================================='
print '============================================================================================='
print '#Region "Fields" '
DECLARE get_Data CURSOR
FOR SELECT COLUMN_NAME ,DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = @TableName
ORDER BY ORDINAL_POSITION
OPEN get_Data
FETCH NEXT FROM get_Data into @Column1,@Datatype
WHILE @@FETCH_STATUS = 0
BEGIN
set @ActColumn1 = @Column1
if @Datatype = 'int'
Set @FieldType = 'Integer'
else if @Datatype = 'tinyint'
Set @FieldType = 'Int16'
else if @Datatype = 'float'
Set @FieldType = 'Double'
else if @Datatype = 'varchar' or @Datatype = 'text'
Set @FieldType = 'String'
else
Set @FieldType = @Datatype
PRINT 'Me.'+ @Column1 + ' = ' + @Column1
FETCH NEXT FROM get_Data into @Column1,@Datatype
End
CLOSE get_Data
DEALLOCATE get_Data
print ' #End region'
print '============================================================================================='
Tuesday, October 4, 2011
Find Modified Procedures,Functions,Views In SQL Server
/*
Below code is for SQL 2008
*/
SELECT 'EXEC sp_HelpText '+name, create_date, modify_date,type
FROM sys.objects
WHERE type in ('P','FN','V','TF')
AND DATEDIFF(D,modify_date, GETDATE()) < 10 --How old the object can be ?
ORDER BY modify_date
Wednesday, September 21, 2011
Validate URL in ASP.NET
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script language="javascript" type="text/javascript">
function Validate() {
var txtURL = document.getElementById("<%=txtURL.ClientID %>");
if (txtURL.value == "http://") {
ValidatorEnable(document.getElementById("<%=rxURL.ClientID %>"), false);
}
else {
ValidatorEnable(document.getElementById("<%=rxURL.ClientID %>"), true);
return document.getElementById("<%=rxURL.ClientID %>").isvalid;
}
return false;
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:RegularExpressionValidator ID="rxURL" runat="server" ControlToValidate="txtURL" SetFocusOnError="true"
ValidationGroup="requiredGroup" Enabled="false" ErrorMessage="*" ValidationExpression="[http(s)?://]*([\w-]+\.)+[\w-]+(/[\w- ./?%&=]*)?"></asp:RegularExpressionValidator>
<asp:TextBox runat="server" ID="txtURL"></asp:TextBox>
<asp:Button ID="btnCheckURL" Text="Check URL" runat="server" OnClientClick="return Validate();" />
</div>
</form>
</body>
</html>
Tuesday, September 20, 2011
TRIM STRING IN JAVASCRIPT
function trimAll(sString) {
while (sString.substring(0, 1) == ' ') {
sString = sString.substring(1, sString.length);
}
while (sString.substring(sString.length - 1, sString.length) == ' ') {
sString = sString.substring(0, sString.length - 1);
}
return sString;
}
Wednesday, September 14, 2011
Export RDLC Report in Asp.Net
Imports Microsoft.Reporting.WebForms
Imports System.Xml
Imports System.Xml.XPath
Public Class ExportRDLCReport
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
ExportReport()
End Sub
Private Sub CreateTempRDLCFile()
Dim doc As New System.Xml.XmlDocument
Dim objXmlNamespaceManager As New XmlNamespaceManager(doc.NameTable)
objXmlNamespaceManager.AddNamespace("rd", "http://schemas.microsoft.com/SQLServer/reporting/reportdesigner")
objXmlNamespaceManager.AddNamespace("d", "http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition")
doc.Load(Server.MapPath("~") & "\Reports\OriginalReport.rdlc")
Dim navigator As XPathNavigator = doc.CreateNavigator()
Dim arr(3, 23) As String
Dim index As Integer = 0
'Find TablixColumn Node From xml Doc and save xml data in 0th row of Array
Dim nodes As XmlNodeList = doc.SelectNodes("//d:TablixColumn", objXmlNamespaceManager)
For _index As Short = 0 To 23
arr(index, _index) = nodes.ItemOf(_index).InnerXml
Next
index += 1
'Find TablixCell Node From xml Doc and save xml data in 1st and 2nd row of Array
Dim xpath As String = "/d:Report/d:Body/d:ReportItems/d:Tablix/d:TablixBody/d:TablixRows/d:Tablix"
'Row("")
Dim nodes1 As XmlNodeList = doc.SelectNodes(xpath, objXmlNamespaceManager)
For Each nod As XmlNode In nodes1
Dim childnode1 As XmlNodeList = nod.SelectNodes("child::d:TablixCells/d:TablixCell", objXmlNamespaceManager)
For _index As Short = 0 To 23
arr(index, _index) = childnode1.ItemOf(_index).InnerXml
Next
index += 1
Next
'Find TablixMember Node From xml Doc and save xml data in 1st and 2nd row of Array
Dim xpathParam As String = "/d:Report/d:Body/d:ReportItems/d:Tablix/d:TablixColumnHierarchy"
nodes1 = doc.SelectNodes(xpathParam, objXmlNamespaceManager)
For Each nod As XmlNode In nodes1
Dim childnode1 As XmlNodeList = nod.SelectNodes("child::d:TablixMembers/d:TablixMember", objXmlNamespaceManager)
For _index As Short = 0 To 23
arr(index, _index) = childnode1.ItemOf(_index).InnerXml
Next
Next
'Set comma seperated list of column number to be displayed in exported report
'please note that you need to add all columns in your original report here otherwise
'it will give error
Dim tempStrColumnSortOrder As String = ",5,3,2,4,1,"
'Rewrite xml as doc as per new sortOrder of columns and save it in temp(file)
Dim strNewSortOrder() As String = Split(tempStrColumnSortOrder.TrimEnd(CChar(",")), ",")
Dim _nexIndex As Short = 0
For i As Short = 0 To CShort(strNewSortOrder.Length - 1)
Dim childnode0 As XmlNodeList = doc.SelectNodes("//d:TablixColumn", objXmlNamespaceManager)
childnode0.ItemOf(_nexIndex).InnerXml = arr(0, CInt(strNewSortOrder(i)))
Dim childnode1 As XmlNodeList = doc.SelectNodes(xpath, objXmlNamespaceManager).ItemOf(0).SelectNodes("child::d:TablixCells/d:TablixCell", objXmlNamespaceManager)
childnode1.ItemOf(_nexIndex).InnerXml = arr(1, CInt(strNewSortOrder(i)))
Dim childnode2 As XmlNodeList = doc.SelectNodes(xpath, objXmlNamespaceManager).ItemOf(1).SelectNodes("child::d:TablixCells/d:TablixCell", objXmlNamespaceManager)
childnode2.ItemOf(_nexIndex).InnerXml = arr(2, CInt(strNewSortOrder(i)))
Dim childnode3 As XmlNodeList = doc.SelectNodes(xpathParam, objXmlNamespaceManager).ItemOf(0).SelectNodes("child::d:TablixMembers/d:TablixMember", objXmlNamespaceManager)
childnode3.ItemOf(_nexIndex).InnerXml = arr(3, CInt(strNewSortOrder(i)))
_nexIndex = CShort(_nexIndex + 1)
Next
doc.Save(Server.MapPath("~") & "\Reports\TempReport.rdlc")
End Sub
Sub ExportReport()
Dim ab As New Microsoft.Reporting.WebForms.LocalReport()
Dim dsSource As DataSet ''Your dataset for report
ab.ReportPath = "Reports\OriginalReport.rdlc"
CreateTempRDLCFile()
ab.ReportPath = "Reports\TempReport.rdlc"
ab.ShowDetailedSubreportMessages = True
Dim paramList As New List(Of Global.Microsoft.Reporting.WebForms.ReportParameter)
paramList.Add(New ReportParameter("prm1", CStr((True)), False))
ab.SetParameters(paramList)
ab.DataSources.Add(New ReportDataSource("GroupDetail", dsSource.Tables(0).DefaultView))
ab.DataSources.Add(New ReportDataSource("ContactDetail", dsSource.Tables(1)))
ab.DataSources.Add(New ReportDataSource("GroupAddress", dsSource.Tables(2)))
AddHandler (ab.SubreportProcessing), AddressOf Me.SetSubDataSource
ab.Refresh()
Dim results As Byte() = Nothing
Dim mimeType As String = String.Empty
Dim extension As String = String.Empty
Dim encoding As String = String.Empty
Dim streamIDs As String() = Nothing
Dim warnings As Warning() = Nothing
Dim name As String = ""
Dim type As String = ""
Dim strFileName As String = "Your Required File Name"
strFileName = strFileName.Replace("\", "")
strFileName = strFileName.Replace("/", "")
strFileName = strFileName.Replace(":", "")
strFileName = strFileName.Replace("?", "")
strFileName = strFileName.Replace("*", "")
strFileName = strFileName.Replace("<", "")
strFileName = strFileName.Replace(">", "")
strFileName = strFileName.Replace("|", "")
'IF want to export as Excel
results = ab.Render("Excel", Nothing, mimeType, encoding, extension, streamIDs, warnings)
name = strFileName & ".xls"
type = "Application/x-msexcel"
'If want to export as PDF
results = ab.Render("Pdf", Nothing, mimeType, encoding, extension, streamIDs, warnings)
name = strFileName & ".pdf"
type = "Application/pdf"
HttpContext.Current.Response.AppendHeader("content-disposition", "attachment; filename=" + name)
If type <> "" Then
HttpContext.Current.Response.ContentType = type
End If
If Not IsNothing(results) Then
HttpContext.Current.Response.BinaryWrite(results)
HttpContext.Current.Response.End()
End If
End Sub
Public Sub SetSubDataSource(ByVal sender As Object, ByVal e As SubreportProcessingEventArgs)
e.DataSources.Add(New ReportDataSource("AdventureWorksDataSet_Contact"))
End Sub
End Class
Friday, September 9, 2011
How to render user control in asp.net with ajax
$.ajax({
type: "POST",
url: "..GetData.aspx",
data: 'param=ctlParam&qs=' + val1,
success: function (data) {
//do what you need
},
error: function (request, status, error) {
alert(request.responseText);
}
});
}
Use the code in .aspx page
Dim strparam As String = Request.Form("param")
Dim strResponse As String = ""
hshProperty.Add("qs", Convert.ToInt32(Request.Form("qs")))
strResponse = ViewManager.RenderUserControl("yourcontrol.ascx", hshProperty)
''qs will be property in yourcontrol.ascx
Response.Write(strResponse)
Tuesday, August 23, 2011
Good IT companies at ahmedabad / gandhingar
1. Cybage Software Pvt. Ltd.
2. iGATE Patni
3. TCS
4. IMany
5. Cygnet Infotech Pvt Ltd.
6. Clarion Technologies
7. INDUSA Technical Corp
8. TatvaSoft
9. Avani Cimcon Technologies Inc
10.Elitecore Technologies Pvt. Ltd.
11.SNL Financial
I'll continue adding names of the company of which I will get some authenticated information from authenticated sources.
Tuesday, February 8, 2011
Get Team Members of A Supervisor
/*
Suppose you have table Employees as shown below
EmployeeID FirstName LastName ReportsTo
1 Nancy Davolio 2
2 Andrew Fuller NULL
3 Janet Leverling 2
4 Margaret Peacock 2
5 Steven Buchanan 2
6 Michael Suyama 5
7 Robert King 5
8 Laura Callahan 2
9 Anne Dodsworth 5
and you want to find employes to whom Steven Buchanan supervise
you can use below query to retrieve the required list
*/
--Get Team Members of A Supervisor
Declare @EmployeeID Int
Set @EmployeeID = 5
;WITH GetEmployee(EmployeeId,EmpName)
AS (
Select EmployeeId,FirstName + ' ' + LastName as EmpName
From Employees E
Where EmployeeId=@EmployeeID
UNION ALL
Select E.EmployeeId,FirstName + ' ' + LastName as EmpName
From Employees E,GetEmployee G
Where E.ReportsTo =G.EmployeeId
)
Select *
From GetEmployee