Tuesday, June 25, 2013

Transformations in WPF

It will use to change the position of a control in particular angle is called Transformation.WPF supports three types of
Transformations.
1.Rotate Transformation
2.Skew Transformation
3.Scale Transformation

Example:
Open WPF project
Replace grid with Canvas tag
Type as follows with in the Canvas
<Button.Render.Tranformation>
<Rotate Transform Angle="45"/>
//Skew:
<skew Transform angle x="30" ,angle y="30"/>
//Scale :
<Scale Transform scale x="2" scale y="2"/>

Wednesday, June 19, 2013

page error event in asp.net

This event can have error handling code using which user can get some info about the problem.Normally we will create page error event code by redirecting user with that page
protected void page_error(object seender,EventArgs e)
{
Response.Redirect("Error. Html");
}
protected void btn_clikc(object sender,EventArgs e)
{
int a=0,c=10;
int b=c/a;
Response.Write(b.Tostring());
}
Implemented using <custom errors> tag of web.config and also using application _error event of Global.aspx  file
Web.config:
<custom errors mode="on" DefaultRedirect="error.html"></custom errors>
In the same custom error a sub tag called error is present.In this tag we can specify particular error and redirecting
<appsettings>
<connectionStrings/>
<system.web>
<custom errors mode="ReadOnly" default Redirect="error.html"?
<error status code=404" redirect="nofile.html"/>
If user attempts to go for a file which is not present then nofile page will be displayed and for any other if goes to error page.Here we should notice "both files are created by user"

Saturday, June 8, 2013

Jquery highlight Gridview selected rows in asp.net

Title: How to highlight grid view rows using jquery in asp.net

Description:
using client script we can make lot functionality on design side.Now i would like explain how to use jquery on data controls in asp.net .Whenever we have to select specified rows with particular style on client side ,the jquery can solve this task

Example:
In previous articles we have seen Bind Data to Grid view,Edit,Delete,Update in Grid view in asp.net,Import Excel to Grid view asp net.Here i will show how to Highlight grid view selected rows.
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
<title>Gridview selected Row highlight using jquery</title>
<script src="http://code.jquery.com/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
$(document).ready(function () {
$("#<%=GVdynamic.UniqueID%> tr").click(function () {
$(this).css("font-weight", "bold");
$(this).css("background-color", "SkyBlue");
$(this).css("border", "2px solid Green");
});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<asp:GridView ID="GVdynamic" runat="server" AutoGenerateColumns="False"
DataSourceID="sySql">
<Columns>
<asp:BoundField DataField="DyOrderID" HeaderText="DyOrderID" />
<asp:BoundField DataField="DyOrderName" HeaderText="DyOrderName" />
<asp:BoundField DataField="DyPhone" HeaderText="Phone" />
<asp:BoundField DataField="DyAddress" HeaderText="DyAddress" />
<asp:BoundField DataField="DyAmount" HeaderText="DyAmount" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="dySql" runat="server"
    ConnectionString="<%$ ConnectionStrings:Connection %>"
    SelectCommand="SELECT * FROM [dyOrders]"></asp:SqlDataSource>
</form>
</body>
</html>

Bel