Swf not working in Aspx page

Many of you might have come to a problem of Swf not working in Aspx page. You might have tried to embed flash object in the ASP.NET page but it doesn’t work even after modifying parameters. The same thing might be working in the simple HTML page but not in the ASP.NET.

Why?

Because most of the examples on internet shows the example as:

<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="800" height="400" id="banner">
    <param name="movie" value="images/FileName.swf" />
    <param name="quality" value="high" />
    <embed src="images/FileName.swf" width="800" height="400" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />
  </object>

It works in the simple HTML page, you run it, it works fine but when you put it in the ASPX page and try to run using the website URL, it doesn’t work

Actually the problem resides in the file path because you have to provide the relative path which can be accessed using the website URL.

So you can fix it by modifying the above code as mentioned below:

<object id="banner" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
                            width="800" height="400">
                            <param name="movie" value="http://localhost/WebsiteName/images/FileName.swf" />
                            <param name="quality" value="high" />                            
                            <embed src="http://localhost/WebsiteName/images/FileName.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer"
                                type="application/x-shockwave-flash" width="800" height="400"></embed>
                        </object>

Enjoy!!!

Web developer required in Lahore and Karachi

Web developers Required (Karachi & Lahore)
We are looking for a Web developer to work on a series of projects for us. Job requirements are as follows:

  • Ability to work independently
  • Front end web development including HTML and CSS
  • PHP/MySQL knowledge and experience.
  • Use of JavaScript, JQuery and AJAX
  • Experience of using OS Commerce, Magento, WordPress and other CMS platforms.
  • use of Object Oriented PHP frameworks
  • Understanding of web security, accessibility and usability
  • Experience of developing with modern CMS systems
  • Knowledge of SEO techniques and best practices
  • Anything else you’re proud of!

You should have a portfolio showcasing examples of your skills in some of the above mentioned expertise.

If you think you can be part of our project, email us on jobs@techcity.pk

How to add processing div in web page

You might be wondering on How to add processing div in web page using jQuery in ASP.NET, this processing bar will be shown on each user action which is going back to server. You can download all the supporting files including javascript and images by clicking here, you may follow the steps below to add the processing div.

First of all you need to add the script reference to the some javascript files. There are multiple ways to add a reference.

1. If you are using Telerik then add a reference to your Telerik assembly on the page:

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

then put these lines in your page under ‘form’ tag.

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>

then put these lines in your page under 'form' tag.

<telerik:RadScriptManager ID="ToolkitScriptManager1" runat="server" >
        <Scripts>
            <asp:ScriptReference Path="~/Scripts/ProgressScript.js" />
            <asp:ScriptReference Path="~/Scripts/jquery-1.4.1.min.js" />
        </Scripts>
    </telerik:RadScriptManager>

2. If you are using AjaxControlToolkit then add a reference to your AjaxControlToolkit assembly:

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>

then put these lines in your page under ‘form’ tag.

<cc1:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
        <Scripts>
            <asp:ScriptReference Path="~/Scripts/ProgressScript.js" />
        </Scripts>
    </cc1:ToolkitScriptManager>

now you need to define the div which will be displayed as a processing div.

<div id="pnlPopup" class="PrProgress" style="display: none;">
        <div id="innerPopup" class="PrContainer">
            <div class="PrHeader">
            
               <asp:Label ID="Label9" runat="server" Text="<%$ Resources:Language, PleaseWait %>" />
               
               </div>
            <div class="PrBody">
                <asp:Image runat="server" Width="220px" Height="19px" AlternateText="loading..."  ID="imgUpdateProgress" ImageUrl="~/images/activity.gif" />
                
            </div>
        </div>
    </div>

You might have notices that there are few CSS classes being used, they are described below:

.PrProgress
{
    display: block;
    position: absolute;
    padding: 2px 3px;
}
.PrContainer
{
    border: solid 1px #808080;
    border-width: 1px 0px;
}
.PrHeader
{
    background: url(../../Images/sprite.png) repeat-x 0px 0px;
    border-color: #808080 #808080 #ccc;
    border-style: solid;
    border-width: 0px 1px 1px;
    padding: 0px 10px;
    color: #000000;
    font-size: 9pt;
    font-weight: bold;
    line-height: 1.9;  
    white-space:nowrap;
    font-family: verdana,helvetica,clean,sans-serif;
}
.PrBody
{
    background-color: #f2f2f2;
    border-color: #808080;
    border-style: solid;
    border-width: 0px 1px;
    padding: 10px;
}
.PrIFrame
{
	
}

Now you need to call some javascript to make it function, add this javascript at the end of your page before “body” closing tag.

<script type="text/javascript">
        Sys.Application.add_load(applicationLoadHandler);
        Sys.Application.add_unload(applicationUnloadHandler);
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(endRequestHandler);
        Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(beginRequestHandler);
    </script>

Just run the page in the browser and see the difference on each server action.

ASP NET Developer Commodities Trading Hong Kong

C#/ASP.NET Developer – Commodities Trading – Hong Kong

Hi,

There is an opportunity for an expert C#/ASP.NET Developer to work in a leading global commodities trading company (based in HK).

The main focus of the role is to build a new trading system for treasury products. The team is using .NET 3.5 and will shortly be moving onto .NET 4.0 so they are looking for someone with strong experience using the latest .NET tech (e.g. MVC, WPF, WCF etc).

This is a 12 month rolling contract based in Hong Kong. The monthly rate is negotiable depending on relevant skills and experience. The client

Essential skills:
– Expert C#/ASP.NET programming
– Strong experience with .NET 3.5 or above
– Strong foundation in oo programming (C++/Java/C#/ASP.NET – not VB)
– Solid database design skills (SQL Server)
– Bachelors degree or above in a scientific discipline (Comp Sci, Engineering, Maths etc)

Ideal experience:
– WPF, WCF, MVC
– Experience working on trading systems

If you would like to apply for this role please send an up to date copy of your CV at o.fawke@huxley.com.

http://www.huxley.com

Compare date and time using RadDateTimePicker

After searching a lot I found the solution to compare date and time using RadDateTimePicker because it was not fulfilling my requirements. So if you are working with Telerik RadDateTimePicker and you want to compare date and time using RadDateTimePicker then you can use the following code:

Lets say you have following two RadDateTimePicker controls on your page for start date and end date:

This one

<telerik:RadDateTimePicker ID=”dpStartDateTime” runat=”server”>
<TimeView ID=”TimeView1″ Interval=”00:30:00″ runat=”server” StartTime=”07:30:00″>
</TimeView>
<DateInput ID=”DateInput1″ runat=”server”>
<ClientEvents OnLoad=”onLoadRadTimePicker1″></ClientEvents>
</DateInput>
</telerik:RadDateTimePicker>

and the other one

<telerik:RadDateTimePicker ID=”dpEndDateTime” runat=”server”>
<TimeView ID=”TimeView2″ Interval=”00:30:00″ runat=”server” StartTime=”07:30:00″>
</TimeView>
<DateInput ID=”DateInput2″ runat=”server”>
<ClientEvents OnLoad=”onLoadRadTimePicker2″></ClientEvents>
</DateInput>
</telerik:RadDateTimePicker>

Your RadDateTimePicker may have different properties for TimeView according to what you want to display in time picker.

Now you have to put the CustomValidator control on your page in order to do the validation for start and end date.

<asp:CustomValidator runat=”server” ID=”CustomValidator1″ Text=”*” Display=”dynamic”
EnableClientScript=”true” ClientValidationFunction=”compare” />

You can set the ValidateEmptyText=”false” in the above tag if you do not want to compare the empty text.

Also you can set the ValidationGroup=”YourValidationGroupName” in the above tag if you want to do the validation for specific group using specific button click.

Now you have to write your CustomValidator ClientValidationFunction which will do the validation and date time comparison.

<script type=”text/javascript”>

//<![CDATA[
var RadTimePicker1;
var RadTimePicker2;

function compare(sender, args) {
var Date1 = new Date(RadTimePicker1.get_selectedDate());
var Date2 = new Date(RadTimePicker2.get_selectedDate());

args.IsValid = true;
if ((Date2 – Date1) <= 0) {
alert(‘End date time must be greater than start date time’);
args.IsValid = false;
}
}

function onLoadRadTimePicker1(sender, args) {
RadTimePicker1 = sender;
}

function onLoadRadTimePicker2(sender, args) {
RadTimePicker2 = sender;
}
//]]>

</script>

Enjoyyyy!!!

How to format currency value entered in a text box using Javascript and ASP.NET

You might be in a situation where you want to display the value entered by user in a proper currency format e.g. if user entered 10000 and you want to format it like 10,000. In order to do so you’ve to follow these steps:

 

First add a text box in your asp.net page/control

 

<asp:TextBox ID=”txtTotal_Amount” runat=”server”></asp:TextBox>

 

Then add an attribute for OnKeyUp and OnKeyPress events

 

txtTotal_Amount.Attributes.Add(“OnKeyUp”, “OnCurrencyValueKeyUp(this);”);

txtTotal_Amount.Attributes.Add(“OnKeyPress”, “OnCurrencyValueKeyUp(this);”);

 

Now you’ve to define the function OnCurrencyValueKeyUp in order to handle the formatting

 

function OnCurrencyValueKeyUp(input)

{

if(input.value.toString().length == 1 && input.value.toString() == ‘0’)

input.value = input.value.replace(‘0’,”);

 

var num = input.value.replace(‘.’,”);

num = input.value.replace(/,/g,”);

if((!isNaN(num)|| num==’-‘) && num != ‘-0’)

{

if(num.indexOf(‘.’) > -1)

{

num = num.split(‘.’);

num[0] = num[0].toString().split(”).reverse().join(”).replace(/(?=d*.?)(d{3})/g,’$1,’).split(”).reverse().join(”).replace(/^[,]/,”);

if(num[1].length > 2)

{

num[1] = num[1].substring(0,num[1].length-1);

}

input.value = num[0]+’.’+num[1];

}

else

{

input.value = num.toString().split(”).reverse().join(”).replace(/(?=d*.?)(d{3})/g,’$1,’).split(”).reverse().join(”).replace(/^[,]/,”) };

}

else

{

input.value = input.value.substring(0,input.value.length-1);

}

input.value = input.value.toString().replace(/$| /g,”);

input.value = input.value.toString().replace(‘.’,”);

input.value = input.value .toString().replace(‘-,’,’-‘);

 

}

 

That’s it, just run your application and try it. Waiting for your comments on this article

How to restrict HTML/Javascript tags using Javascript and ASP.NET

There is a security threat that people use scripting tags into the input fields in order to hack/malfunction the application, you may use the steps described below in order to restrict the user not to enter these kind of tags:

 

Add a text box in your asp.net page/control

 

<asp:TextBox ID=”txtComments” runat=”server”></asp:TextBox>

 

Then add an attribute for OnClick and OnKeyPress events

 

txtComments.Attributes.Add(“OnClick”, “return RestrictHTMLTags();”);

 

Now you’ve to define the function RestrictHTMLTags in order to restrict the HTML tags

 

function RestrictHTMLTags()

{

txt_box=document.getElementsByTagName(‘INPUT’);

for (txt_0=0; txt_0 < txt_box.length; txt_0++)

{

if (txt_box[txt_0].type==’text’)

{

var str1=parseInt(txt_box[txt_0].value.indexOf(‘<‘))

var str2=parseInt(txt_box[txt_0].value.indexOf(‘>’))

if (str1 >= 0 || str2 >= 0 )

{

alert(“HTML or JavaScript tags are not allowed”)

txt_box[txt_0].value=”;

txt_box[txt_0].focus();

return false;

}

}

}

return true;

}

 

That’s how you restrict the user not to enter the restricted tags. Waiting for your comments on this article

Interview Questions

This article lists different interview questions along with their categories plus some useful topics.

General/ IQ Questions

  1. Introduce Yourself
  2. You have 9 balls one is heavier out of them, in 2 turns using a balance tool you’ve to find out the heavier one
  3. You have 8 balls one is heavier out of them, in 2 turns using a balance tool you’ve to find out the heavier one
  4. A=200, B=17, divide them using +,-,* without using division operator

Software Design Questions

  1. Difference between procedural and object oriented programming
  2. What is inheritance
  3. Describe Association, Composition, aggregation, containment
  4. What is UML and how many types of diagrams are there in UML
  5. What is association and how we show it in UML
  6. Best sorting algorithm and why
  7. What are Design Patterns and how they are categorized?
  8. Data Structures
  9. Design and analysis of Algos
  10. OOP concepts

.NET/C# Questions

  1. Whats the different between abstract classes n interfaces
  2. Does C# support multiple inheritance, if not, whats the logical reason behind that, if yes then how we can achieve that, e.g. using interfaces, what are its pros n cons
  3. What is an Assembly
  4. Features of .Net Framework 3.0 (WCF, WPF, WF, WC)
  5. Partial Classes
  6. .NET Architecture
  7. .NET remoting
  8. DLL Hell problem

ASP.NET/Web Questions

  1. Architecture and Features of IIS 6.0
  2. Page Life Cylce
  3. ViewState
  4. Master pages and themes
  5. XML, XHTML and XAML
  6. ASP.NET Architecture
  7. AJAX
  8. Authentication n authorisation (ASP.NET Web application + IIS security)
  9. Web Services and their Protocols

SQL Server Questions

  1. Joins
  2. Cursors
  3. Connection Pooling
  4. Normalization

Advanced Concepts

  1. Cloud Computing
  2. Grid Computing
  3. MS Dynamics
  4. Sharepoint (MOSS)
  5. ERP
  6. CRM
  7. Service Oriented Architecture