This page has moved. You will be automatically redirected to its new location in 10 seconds. If you aren't forwarded to the new page, click here.

Search This Blog

Thursday, July 30, 2009

The application-specific permission settings do not grant Local Activation permission for the COM Server application with CLSID{61738644-F196-11D0-995

http://community.spiceworks.com/windows_event/show/84-dcom-10016

My issue was related to an IIS service

following is the resolution from the above link:

1. Open the registry and go to "HKEY_CLASSES_ROOT\CLSID\{} to find out friendly name of this component. In my case, this is "Machine Debug Manager” (CLSID: 0C0A3666-30C9-11D0-8F20-00805F2CD064).

2. Go to Component Services via Start -> Control Panel -> Administrative Tools -> Components Services. Expand the Component Services branch then expand "Computers", "My Computer", and "DCOM Config". Right-click on "Machine Debug Manager" (or whatever your CLSID represents) and choose Properties. Click on the Security tab and under “Launch and Activation Permissions” select "Use Default". Click OK, close the Component Services window. The error should disappear now.

Using Image as a submit button

http://www.webdevelopersnotes.com/tips/html/using_an_image_as_a_submit_button.php3

Friday, July 24, 2009

Use multiple columns in a databound drop down list

http://aspnetgoodies.wordpress.com/category/multiple-columns-in-data-bound-drop-down-list/

I got this idea from the above link; but my problem was that i had to get an aggregate function value and a normal column value and show them in my list e.g.

New (0)
Pending (13)
Old (3)
Discarded (50)

the above are the status types (New, Pending, Old, Discarded) and then (xyz) is the total number of applications which lie in this status. so basically two queries are used. One for selecting the application statuses, and the other from selecting the count of applications in the respective status.

So this is what I did:

Created a UDF to get the counts:

CREATE FUNCTION GetCountsForStatusType
(
-- Add the parameters for the function here
@statusTypeID Int
)
RETURNS int
BEGIN
Declare @myCountVar Int
select @myCountVar= count(appStatusId) from tblApplications where appStatusId = @statusTypeID and (AppProvince <> 'Ontario' or ( appStatusId =@statusTypeID and AppProvince = 'Ontario' and appCreateDate < '6/30/2009'))
Return @myCountVar
END

Then; I created a View:

Create View [dbo].[statusTypesWithCount]
As
SELECT statusTypeId,
statusTypeName + ' (' + convert(varchar(80),dbo.GetCountsForStatusType(statusTypeId)) + ')' AS statusTypeName
FROM dbo.tbAppStatusTypes

Then finally; I created a stored procedure with this query:

select * from statusTypesWithCount order by statusTypeId asc

and then bound the dropdownlist with this datasource; and chose DataTextField="statusTypeName"

There you go :)

ASP Include Files

http://www.w3schools.com/asp/asp_incfiles.asp

Difference b/w include Virtual and include file

ASProxy

http://www.codeproject.com/KB/aspnet/asproxy.aspx

Get data from DataReader using column name

drName("columnName")

but research says this is very expensive so try to use GetOrdinal method of the datareader and then get the index to retrieve the data

Set Page Title dynamically

http://aspnet.4guysfromrolla.com/articles/051006-1.aspx

Invalid attempt to read when no data is present

http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/076fdaa2-6a17-4ce7-87bf-0d9340cfc61e

Use datareaderName.Read()

There is already an open DataReader associated with this Command which must be closed first

http://social.msdn.microsoft.com/Forums/en-US/adodotnetdataproviders/thread/78d3989a-8975-4930-998d-1eb907966f57

Sunday, July 19, 2009

'System.Array' does not contain a definition for 'Contains' ...

http://social.msdn.microsoft.com/Forums/en-US/csharpgeneral/thread/d20d585c-de6f-4fce-bb62-8a4ff2321657

You have to Add Linq references.

using System.Linq; and (possibly):
using System.Data.Linq; // not sure about the latter though.

Wednesday, July 15, 2009

Accessing web.config key using javascript

I was using this way to get web.config key value in javascript:


but i got this error:

Too many characters in character literal

because my string was very long. So I used this way instead:


Another way:



Add javascript & HTML in Blogger posts

http://share-useful-links.blogspot.com

Use the HTML Parser to convert your code, and then post in blogger :)

Access function defined in parent from inside an Iframe

this is the function defined in a.aspx
this page has an iframe which will call this method

<script type="text/javascript">
var myIframeUrl;
function modifyVar(val) {
myIframeUrl = val;
}
</script>
-----------
in the iframe use this statement:
<script type='text/javascript'>parent.modifyVar('" + requestURL + "');</script>"

Get form hidden variable value from outside the IFrame

An iframe contains a form with a hidden variable (input type =" hidden">and I needed to access this hidden variable in the parent page which contains the Iframe, here is how I did it:


but it didnt work for every website, on some it gave the javascript permission denied error:

Get Current URL of an Iframe

http://forums.devarticles.com/programming-tools-11/how-do-i-get-the-url-of-an-iframe-11460.html - Useful for me in some cases

Javascript string functions

http://www.w3schools.com/jsref/jsref_obj_string.asp

Monday, July 13, 2009

Access Session variables inside an asp.net handler

http://www.codedigest.com/CodeDigest/23-Accessing-Session-Variable-in-HttpHandler-in-ASP-Net.aspx

Failed to access IIS metabase

http://geekswithblogs.net/narent/archive/2007/03/23/109573.aspx

Create a web application using SharePoint Designer

http://blogs.technet.com/brenclarke/archive/2009/04/14/creating-a-quiz-web-application-using-sharepoint-designer.aspx

Read XLS and XLSX files using .net

string filenames = path.Substring(path.LastIndexOf("\\") + 1);
string ext = filenames.Substring(filenames.LastIndexOf(".") + 1);
if (ext == "xls" || ext == "xlsx")
{

String strExcelConn = "Provider=Microsoft.ACE.OLEDB.12.0;"
+ "Data Source=" + path
+ ";Extended Properties='Excel 8.0;HDR=Yes'";
OleDbConnection connExcel = new OleDbConnection(strExcelConn);
OleDbCommand cmdExcel = new OleDbCommand();
cmdExcel.Connection = connExcel;
connExcel.Open();
System.Data.DataTable dtExcelSchema;
dtExcelSchema = connExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, null);

System.Data.DataSet ds = new System.Data.DataSet();
string SheetName = dtExcelSchema.Rows[0]["TABLE_NAME"].ToString();
cmdExcel.CommandText = "SELECT Top 10 * From [" + SheetName + "]";
System.Data.OleDb.OleDbDataAdapter da = new OleDbDataAdapter(cmdExcel);
System.Data.OleDb.OleDbDataReader dr = cmdExcel.ExecuteReader();
}

Sunday, July 5, 2009

Wednesday, July 1, 2009

Hidden div not displaying in Firefox (display:none)

Don't use:

var obj=document.getElementById('divname');
if (obj.style.display=='none'){obj.style.display="";}

(the above works only in IE, not in firefox)
Instead; use:

document.getElementById('divname').style.display="";
(the above works both in firefox n IE)

Post html form to aspx page

http://stackoverflow.com/questions/209301/how-to-post-a-form-from-html-to-aspx-page

dont forget the "name" attribute :)