Feeds:
Posts
Comments

fun with Javascript

I faced a problem to call 2 methods at the same time from body. and the solution is very simple. I wrote a script block at the end of the page look like that.

<SCRIPT LANGUAGE=”JAVASCRIPT”>

if(document.body.onload)

{

var existingOnLoad = document.body.onload;

document.body.onload = function()

{

existingOnLoad();

MyOwnMethod();

}

}

</SCRIPT>

rectangle XAML

i was in fun with XAML, sharing some of my rectangular XAML codes with you.

<Rectangle x:Name=”rectangle” Stroke=”Gray” StrokeThickness=”1″ Fill=”LightYellow” Width=”50″ Height=”50″ />
<Rectangle x:Name=”rectangle” Stroke=”Gray” StrokeThickness=”1″ Width=”50″ Height=”50″ >
<Rectangle.Fill>
<LinearGradientBrush StartPoint=”0,0″>
<GradientStop Color=”White” Offset=”0.0″ />
<GradientStop Color=”Gray” Offset=”1.0″ />
</LinearGradientBrush>
</Rectangle.Fill>
</Rectangle>
<Rectangle x:Name=”start” Stroke=”Gray” RadiusX=”10″ RadiusY=”10″ StrokeThickness=”1″ Width=”50″ Height=”50″>
<Rectangle x:Name=”decision” Canvas.Left=”15″ Height=”40″ Width=”40″ Stroke=”Black” Fill=”LightYellow”>
<Rectangle.RenderTransform>
<RotateTransform Angle=”45″ />
</Rectangle.RenderTransform>
</Rectangle>
<Rectangle Canvas.Left=”10″ Height=”40″ Width=”40″ Stroke=”Black” Fill=”LightYellow”>
<Rectangle.RenderTransform>
<TransformGroup>
<ScaleTransform ScaleX=”1″ ScaleY=”1″/>
<SkewTransform AngleX=”-15″ AngleY=”0″/>
</TransformGroup>
</Rectangle.RenderTransform>
</Rectangle>

I had a very big mysql database backup file, needed to divide that in may part to import in the server. but it is hard to do and time wasting. I got a very good tool to do that. you can try that too.

http://www.ozerov.de/bigdump.php

I have faced an intersting problem in firefox, i have written a simple html like that

<hr style=”color:#FF9900″/>

it shows color in Internet Explorer but color was not showing in Firefox.

Finally i solve that problem is this was

<hr style=”border-top: 1px solid #bae1f7; “/>

Isnteresting browser issue :D

In web application accordion is a very nice using. By using that you can make you website good looking and in a small space you cam put many things. Here am giving you example of a dynamic Accordion which i am loading from a XML file.

Dynamic accordion from xmlTo create that using AjaxControlToolkit. In AjaxControlToolkit a control named Accordion is available , i have just load this dynamically and reading data from XML.
Here are the coder to read data from XML and Load accordion dynamically

Accordion accordion = new Accordion();
accordion.ID = “AccordionID”;
accordion.SelectedIndex = 0;
accordion.FadeTransitions = true;
accordion.FramesPerSecond = 50;
accordion.TransitionDuration = 250;
accordion.SuppressHeaderPostbacks = true;
string _path = HttpContext.Current.Server.MapPath(@”Sitemap.xml”);
FileStream stream = new FileStream(_path, FileMode.Open , FileAccess.Read, FileShare.ReadWrite);
XmlDocument document = new XmlDocument();
document.Load(stream);
XmlNodeList nodeList = document.GetElementsByTagName(“Item”);
for (int i = 0; i < nodeList.Count; i++)
{
AccordionPane accorPane = new AccordionPane();
Label lbl = new Label();
lbl.ID = “lblControl”;
lbl.Text = nodeList[i].Attributes["name"].Value;
lbl.Width = 200;
lbl.BackColor = System.Drawing.Color.Wheat;
lbl.Style.Add(HtmlTextWriterStyle.MarginBottom, “3px”);
accorPane.HeaderContainer.Controls.Add(lbl);
for (int j = 0; j < nodeList[i].ChildNodes.Count; j++)
{
string name = nodeList[i].ChildNodes[j].Attributes["name"].Value;
Label lbl2 = new Label();
lbl2.ID = “lblControl2″;
lbl2.Text = name;
lbl2.Width = 195;
lbl2.BackColor = System.Drawing.Color.WhiteSmoke;
lbl2.Style.Add(HtmlTextWriterStyle.MarginBottom, “2px”);
lbl2.Style.Add(HtmlTextWriterStyle.PaddingLeft, “5px”);
HyperLink hl = new HyperLink();
accorPane.ContentContainer.Controls.Add(lbl2);
accorPane.ContentContainer.Controls.Add(new LiteralControl(“<br/>”));
}
accordion.Panes.Add(accorPane);
}
PlaceHolder1.Controls.Add(accordion);
stream.Close();

I was workign with a small application where i create Accordion runtime. I i got problem for that the problem was “The TargetControlID of ‘_AccordionExtender’ is not valid. The value cannot be null or empty”. I wrote codes like that

This code is not working for Accordion

Finally got the solution just add accordion.ID = “AccordionID” and this problem is solved. So the fixed code is look like that

Create Accordion at tuntime

Now a day’s event management is becoming a very popular idea especially in case of web application development. Most of the application is synchronizing with outlook contacts and calendar. Here is a small tool to create event both hour event and day event. This concept is very simple creating a ics file and sending as mail attachment.
event1.png
I have written an small article on how to send event through mail. Please check here to get complete code.
http://www.codeproject.com/KB/applications/SendAppointment.aspx

ASP.NET 3.5 introduces a new data binding control named the ListView. ASP.NET already has a lot data bind control; it should be more than 10. But the good news is, ListView can literally replace all other data binding controls in ASP.NET. ListView control makes data binding easier than previous controls. It has included styling with CSS, flexible pagination, and sorting, inserting, deleting, and updating features.

ListView control

I have written an article on ASP:ListView in CodeProject, Please go through it to get complete source code of ListView. My Article on ASP:ListView

I saw a nice video today in MIX site this is about Search Engine Optimization. It’s a big video and I really learnt a lot about SEO after see that. You can also see that. Just download SEO video from here and enjoy.
I have written a brief on that video hope you can learn vey basic things from here too

  1. Use HTML semantically
    • Example:
      Good: <H1>this is an Article</H1>
      Bad: <span class=”header1”> this is an Article</span>
      Because: Heading and title tag are more important to robot then span and JavaScript class.
      So be careful to use of common tags its priority sequence is like that <a>, <h1>, <title>, <Meta>, <table>
  2. JavaScript and CSS

    Continue Reading »

Sometime we may need to import contact from client machine’s outlook, in this case we can write javascript to import outlook contacts easily. Here is the code how to do that.

var Const_olFolderContacts = 10;
var objApp = new ActiveXObject(“Outlook.Application”);
var objNS = objApp.GetNamespace(“MAPI”);
var colContacts = objNS.GetDefaultFolder(Const_olFolderContacts).Items
for( var i=1; i<=colContacts.count;i++)
{
 var v = colContacts.item(i);
 alert(v["FullName"]+” (“+v["Email1Address"]+”)”);
}

if this code does not works , please do the following so it should work

In Internet Explorer , go to Tools | Internet Options | Security  -> from ‘Custom Level’ go to ‘Initialize and script ActiveX controls not marked as safe for scripting’ and select ‘Prompt” — this should work now

have got a big detailes code here, you can check this too another code

« Newer Posts - Older Posts »