deneme 1 2
Monday, November 24, 2008
Loading Images Asynchronously Inside a GridView
1) Add a template field for gridview.
<asp:TemplateField>
<HeaderTemplate>Picture</HeaderTemplate>
<ItemTemplate>
<img border="1" src="images/cursor.jpg" onerror="this.src=images/error.jpg" onload="RetrievePicture(this,'<%# Eval("pic_id")%>');"/>
</ItemTemplate>
</asp:TemplateField>
2) Javascript function to call.
<script type="text/javascript" language="javascript">
function RetrievePicture(imgCtrl, picid)
{
imgCtrl.src = 'ShowImage.ashx?id=' + picid;
}
</script>
Consuming .net webservices with Jquery in JASON format.
1) Add [ScriptService] attribute to your webservice.
2) Call your method with JQuery. Very Simple!
$.ajax({
type: "POST",
url: "ServiceName.asmx/WebMethodName",
data: "{'parameter1':'p1','parameter2':'p2'}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
// Do
stuff
}
});
Technorati Tags: Webservices,Jason,JQuery,ASMX,AJAX
Thursday, November 6, 2008
SQL Server: Peer-to-Peer Transactional Replication
It is often necessary to have the same database running in multiple servers. With transactional replication, several instances of the same database can run in completely different servers and communicate to each other. All the insert, update, delete operations are synced between the databases.
An application can benefit from peer-to-peer replication in the following ways:
- Improved read performance, because reads are spread out over two or more servers.
- Higher availability if maintenance is required or in case of failure at one server.
Read More:
http://msdn.microsoft.com/en-us/library/ms151196.aspx
Cool!, So how can I configure this? Here is the link:
Configuration with SQL Management Studio
Tuesday, November 4, 2008
Resize Bitmap C#
public Bitmap ResizeBitmap(Bitmap b, int width, int height)
{
Bitmap result = new Bitmap(width, height);
using (Graphics g = Graphics.FromImage((Image)result))
g.DrawImage(b, 0, 0, width, height);
return result;
}