ASP.NET ImageButton not supported in Firefox 2.0


I recently discovered that the ImageButton and LinkButton ASP.NET controls do not function properly in Firefox 2.0. I wasted almost two days trying to figure out what was wrong with my code. Apparently, I was chasing a ghost! For more information on this problem can be found here. Unfortunately, the only workaround for this problem is to either upgrade to Firefox 3, which ROCKS by the way, or use a standard ASP.NET button and style it using CSS.



Using FlexiGrid in your ASP.NET application


I’ve been exploring JQuery for quiet some time now and I’m already a huge fan! Not only is it light-weight but its extensible too - there are plugins for everything, just name it! Well, almost everything ;) Today I’m going to demonstrate how we can use the excellent FlexiGrid plugin in our ASP.NET applications.

Add the following code to the head section of the document in which you want to display the grid.

1 <link href=“style/flexigrid.css” rel=“stylesheet” type=“text/css” />
2
3     <script src=“scripts/jquery.js” type=“text/javascript”></script>
4
5     <script src=“scripts/jquery.flexigrid.js” type=“text/javascript”></script>
6
7     <script type=“text/javascript”>
8
9         $(document).ready(function(){
10
11             $(“#flex1″).flexigrid
12                 (
13                     {
14                         url: ‘GetData.aspx’,
15                         dataType: ‘xml’,
16                         colModel : [
17                                 {display: 'ISO', name : 'iso', width : 40, sortable : true, align: 'center'},
18                                 {display: 'Name', name : 'name', width : 180, sortable : true, align: 'left'},
19                                 {display: 'Printable Name', name : 'printable_name', width : 120, sortable : true, align: 'left'},
20                                 {display: 'ISO3', name : 'iso3', width : 130, sortable : true, align: 'left'},
21                                 {display: 'Number Code', name : 'numcode', width : 80, sortable : true, align: 'right'}
22                             ],
23
24                         /*searchitems : [
25                             {display: 'ISO', name : 'iso'},
26                             {display: 'Name', name : 'name', isdefault: true}
27                         ],*/
28                         sortname: “iso”,
29                         sortorder: “asc”,
30                         usepager: true,
31                         title: ‘Countries’,
32                         useRp: true,
33                         rp: 15,
34                         showTableToggleBtn: true,
35                         width: 700,
36                         height: 400
37                     }
38                 );
39         });
40
41     </script>

The grid is going to get its data from an aspx file called “GetData.aspx”. In the Page_Load(..) event of this page, generate the XML and send it back to the requesting page.

  1       protected void Page_Load(object sender, EventArgs e)
  2         {
  3
  4             int page = int.Parse(Request.Form["page"].ToString());
  5             int rp = int.Parse(Request.Form["rp"].ToString());
  6             string sortname = Request.Form["sortname"].ToString();
  7             string sortorder = Request.Form["sortorder"].ToString();
  8
  9             string sort = String.Format(“ORDER BY {0} {1}”, sortname, sortorder);
 10
 11             int start = ((page - 1) * rp);
 12
 13             string limit = String.Format(“LIMIT {0}, {1}”, start, rp);
 14
 15             Response.ClearHeaders();
 16             Response.AppendHeader(“Expires”, “Mon, 26 Jul 1997 05:00:00 GMT”);
 17             Response.AppendHeader(“Last-Modified”, DateTime.Now.ToLongDateString() + ” “ + DateTime.Now.ToLongTimeString());
 18             Response.AppendHeader(“Cache-Control”, “no-cache, must-revalidate”);
 19             Response.AppendHeader(“Pragma”, “no-cache”);
 20             Response.AppendHeader(“Content-type”, “text/xml”);
 21
 22             // Generating XML Data
 23
 24             EnumerableRowCollection<DataRow> data = GetCountryDataTable(sort, limit);
 25
 26             XDocument xmlDoc = new XDocument(
 27                 new XDeclaration(“1.0″, “utf-8″, “yes”),
 28                     new XElement(“rows”,
 29                         new XElement(“page”, page.ToString()),
 30                         new XElement(“total”, GetTotalRecords().ToString()),
 31                         data.Select(row => new XElement(“row”, new XAttribute(“id”, row["iso"].ToString()),
 32                                                           new XElement(“cell”, row["iso"].ToString()),
 33                                                           new XElement(“cell”, row["name"].ToString()),
 34                                                           new XElement(“cell”, row["printable_name"].ToString()),
 35                                                           new XElement(“cell”, row["iso3"].ToString()),
 36                                                           new XElement(“cell”, row["numcode"].ToString())
 37                                                          )
 38                                     )
 39                         )
 40             );
 41
 42             Response.Write(xmlDoc);
 43             Response.End();
 44
 45         }

I used LINQ to create the XML document but you can do it using Strings or any other method you prefer.

Happy Programming!



HOW TO: Display RSS Feeds in your PRADO app


This guide will show you how to easily parse and display RSS Feeds in your php application no matter what framework you use. However, I will be using the PRADO framework for this demonstration. The Parser Since I’m a big fan of open-source software, I used MagpieRSS. MagpieRSS provides an XML-based (expat) RSS parser in PHP. The toolkit can be very easily integrated to your PHP application with just one line of code. Follow these steps to install the toolkit into your prado application:

  1. Download the toolkit from here.
  2. Create a folder within the protected folder of your application. You can name it anything you like. I’ll name it Common. Now your applications directory structure should look something like this
  3. Extract the contents of the package that you downloaded in the previous step into the Common folder.
  4. Now you will see a file named rss_fetch.inc. Rename that file to rss_fetch.php. I’ll explain why I did this in the next step.
  5. Include the rss_fetch.php file in your prado class and call the parser within a function as follows
  6. Prado Directory Structure

If we don’t rename rss_fetch.inc to rss_fetch.php in the previous step we cannot use the prado style include statement as shown in Line 1; Instead we have to use include_once(..). I did that just to maintain consistency in my coding style - no biggie ;)


visitor stats
Raihan Iqbal Original Theme By Mukkamu