1
Posted on 5:23 AM by prajeesh and filed under ,
Suppose you have a Grid view and you want to display values returned from a server side function that accepts a bound value rather displaying bounded values itself, then you have to add a template field in the Grid view and add following code.
<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<%#YourFunction(Eval("Status"))%>
</ItemTemplate>
</asp:TemplateField> Shout it kick it on DotNetKicks.com
0
Posted on 9:02 AM by prajeesh and filed under ,
In many situations we may need to add auto number or serial numbers in grid view column, but we cannot find a property in property window to add this.
We can add auto number column in Grid view or Data List by using Container.DataItemIndex property in Gridview or Data List mark up.

Add a Template field and add following code in Grid view Mark up:

<asp:TemplateField HeaderText="Serial Number">
<ItemTemplate>
<%# Container.DataItemIndex + 1 %>
</ItemTemplate>
</asp:TemplateField> Shout it kick it on DotNetKicks.com
0
Posted on 4:32 AM by prajeesh and filed under ,
In a previous post i have explained about calling a web service from javascript, please see this post to see calling a web service without parameters.
Suppose you have a web service that accepts user name and password and returns a value in XML format and you want to show the returned value in a webpage or a widget.

For example :

<?xml version="1.0" encoding="utf-8" ?>
<int xmlns="http://tempuri.org/">1</int>

You can use following code snippet to call a web service from javascript:
<script language="text/javascript">
var returned_data;
var request = new XMLHttpRequest();
//function to initialize web service
function initializeWebservice()
{
var url="http://2test.hopto.org/Leadservice.asmx/GetLeadCounts?UserName=Prajeesh&Password=123456";; //Web service url
request.onreadystatechange = webStatusProc;
request.open( "GET", url, true );
request.send();
}
//function to process webservice response
function webStatusProc()
{
if (request.readyState == 4) // Request completed?
{
response = request.responseXML.toXML();
XML = XMLDOM.parse( response);
returned_data= XML.evaluate('string(/int)');
alert(returned-data);
//do anything with returned data
}
}
</script> Shout it kick it on DotNetKicks.com
0
Posted on 7:55 AM by prajeesh and filed under ,
Google code released an open source web page speed analyzer for Mozilla, called "Page Speed" it works like yahoo Yslow.

Page Speed is an open-source Firefox/Firebug Add-on. Webmasters and web developers can use Page Speed to evaluate the performance of their web pages and to get suggestions on how to improve them.

You can download it from Here Shout it kick it on DotNetKicks.com
0
Posted on 3:48 PM by prajeesh and filed under ,
We can upload images very easily using File upload control in asp.net, also you can validate the upload the file type using Reguler expression validator, following is the regular expression validation control code for validating image types such as jpg, png and bmp.
<asp:RegularExpressionValidator ID="RegularExpressionValidator2" runat="server"
ErrorMessage="Upload a valid image (jpg/png/bmp)"
ValidationExpression ="^.+\.((jpg)(JPG)(gif)(GIF)(jpeg)(JPEG)(png)(PNG)(bmp)(BMP))$"
ControlToValidate="fupImage" ValidationGroup="Author_reg"> Upload a valid image;</asp:RegularExpressionValidator>
Shout it kick it on DotNetKicks.com