August 2008 - Posts

Error Logs

 

When Using Event Log on Asp.net it Shows Requested registry access is not allowed If it shows http 500 , disable the show friendly message on your ie browsers first then you can see the error message. 

Grant permission to create a custom event log  

1.    Log on to the computer as an administrator.
2.    Click Start, click Run, type regedit in the Open box, and then click OK. The Registry Editor window appears.
3.    Locate the following registry subkey: HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog
4.    Right-click Eventlog, and then click Permissions. The Permissions for Eventlog dialog box appears.
5.    Click Advanced. The Advanced Security Settings for Eventlog dialog box appears.
6.    In the Name column, double-click the Users group. The Permission Entry for Eventlog dialog box appears.
7.    Select the Set Value check box, select the Create Subkey check box, and then click OK.
8.    Quit Registry Editor, and then log off from the administrator account.
9.    Log on to the computer as a regular user.
10.  Try to create a custom event log by using Visual Studio .NET, and then try to write to this event log by using an application that is built on Visual Studio .NET. 

When Using Pop3,SMTP Shows Socket 1004: forcibly closed by remote host.

Could be hardware failure, could be dns problem,

Try change the host from computer name to IP

When Using Windows Service the System.Timer is not Firing.

I switch to System.threading.Timer.

System.Threading.Timer t = new System.Threading.Timer(

new System.Threading.TimerCallback(RunCommands),        null,      

0, Convert.ToInt32(ConfigurationManager.AppSettings["IntervalMinutes"])        );  

}       

public static void RunCommands(object stateInfo)      

  {         //do something   }

You can pass any object/custom object to null,this is common for callback architecture. Or another approach which I haven’t tried is to use GC.KeepAlive(System.Timer)

Share this post: | | | |
Posted by cipto with 2 comment(s)
Filed under:

Toolkit Script manager

 

I’ve seen this on scott gu’s blog that refer to another blog. What interesting here is When you Replace your <asp:Script Manager> with <cc1:ToolkitScriptManager>

It supports script combining every script resource on the page.

 

Merge Multiple client-side javascript into a single file that is download to the client at runtime.

 

If you put so many toolkit on your page, you will see it generates separate script resource.and as you suspect with so many file, it has to go back and forth to download the file when needed.

Before

 

 

  After

 

WITH

MiliSECONDS:8840

Ukuran:542265

Waktu Load: 2 second

 

WITH OUT

MIlliSencods:21929

Waktu Load: 3 second

Ukuran:280157

 

 

Save 9 roundtrip

Share this post: | | | |
Posted by cipto with no comments
Filed under:

ListView DataPager UpdatePanel Page Method

 Creating Master Detail, one To Many ListView with Ajax.

Edit

 

 

Add

 

Insert Branches

 

 Paging Style

 

On List View or simillar type of control , you can state commandname on your linkbutton or button .

What have been recognized is insert,update,delete,cancel and custom. This will trigger event iteminserted(&ing), itemupdated(&ing),..delete,..cancel,item command.

If you want to submit changes

onbuttonclick

//this will purge all the data from grid to //datasource

foreach (ListViewDataItem item in ListView1.Items)

{

ListView1.UpdateItem(item.DataItemIndex, true);

For the Skin and modal pop up goto  http://mattberseth.com

To enable page method first you must enable it on the script manager/toolscriptmanager

Second add the Scriptmethod attribute

[WebMethod]
[System.Web.Script.Services.ScriptMethod()]

And then on the client script use the method it’s under PageMethod object.

So PageMethods.MyMethodName(param a, param b);

You can Take the Value of Eval and Compare it, but first unbox the type first, because Eval is Box to Object

Ex:Visible='<%# ((string)Eval("Type")=="Admin")

Remember that Eval is one way binding(read), Bind is two way binding.

I prefer using link button on the template, it saves space and neat not like button so ugly and take space

Source

CodeMappingsInput.zip

 

 22/10/2008

i've found a bug on .cs the ajax always return alert exception from PageRequestManagerServerErrorException

which means that error is comming during async partial postback and the error is in our server coding

 protected void ListView1_ItemUpdated(object sender, ListViewUpdatedEventArgs e)
    {
        //TODO: Add logging here, using utils.Log("Updated " + "What"
        //What can be replaced by e.values , do research here
        StringBuilder sb= new StringBuilder();
        foreach (DictionaryEntry item in e.OldValues)
        {
         if(item.Value!=null)
     
    sb.Append(item.Value.ToString());
        }
        sb.Append (" To ");
        foreach (DictionaryEntry item in e.NewValues)
        {
        if(item.Value!=null)
     
    sb.Append(item.Value.ToString());
        }
        Utils.Log("updated " + sb.ToString());

    }

 

 

Share this post: | | | |
Posted by cipto with 1 comment(s)
Filed under:

ScriptManager InlineScript

Inline script False

Inline Script True

 

Share this post: | | | |
Posted by cipto with 4 comment(s)