I wanted to share few words about our Out going CEO Alexius, surprisingly there was an article on him in TOI...
Please click on link....
http://epaper.timesofindia.com/Default/Scripting/ArticleWin.asp?From=Archive&Source=Page&Skin=TOINEW&BaseHref=TOIBG/2010/03/27&PageLabel=24&EntityId=Ar02401&ViewMode=HTML&GZ=T
Wednesday, March 31, 2010
Saturday, March 27, 2010
Debate: BBMP Election Contenders from Rajarajeshwari Nagar, Bangalore
I like to start this letter by thanking, Namma Bengaluru Organization(NGO), Suvarna News and Radio Indigo 91.9 FM for conducting debate and inviting all the BBMP Rajarajeshwari Nagar Contenders but only few main contenders turned out.
Let me start… The time for the program to start was 7:30 but as usual it started by 8:15… One thing I got disappointed was, I could not see much youngster out there except few and in that many were reports, journalists and students, however my area is filled by highly qualified and educated people and I was happy to see them all. I attended this debate so I could decide whom I could vote in the upcoming BBMP election.
Well let me give some information about the participants in the debate. By sharp 7:30 I could only see one contender that is Dr. Shankara Prasad from Loksatta Party, very interesting guy and want to say few words about him. His qualification is M.Tech in Materials Engineering from IIT-Kanpur, PH.D in Materials Science and engineering from Sate University of New York, USA. He is a Managing Director in Inkroma E-Business Solution, Bangalore. He is into E-Governance Software. He was very proud about him staying and working in 8 countries (he stressed this many times)... his manifesto for our ward was splendid… like installing community portal and internet Kiosks for easy access to RR Nagar ward, information such as Finance, Accounts, Projects, etc. Personally I felt that he forgot he is in India… for present India his views are too high to accept. He wants to bring American kind of governance in India… RR Nagar ward do not only contains Ideal Homes and BEML layout where highly educated people like but areas like, Bangarappa Hil, Nayandahalli, etc… where still uneducated live who are still unaware of Computer and its applications. We can’t bring all the rules that they follow in USA... some of the things are not suitable on this soil even for Indian civilized community. But in future after many years, yes we do like to be ruled by these kind of people.
Well after few minutes of Dr. Shankara Prasad’s speech, there entered JD(S) candidate, Mr. V Govind Raju… He came to the site with his "gang", they looked bit rowdy, kind of uncivilized... even contender seemed to be the same, however he was bit nervous to speak after seeing the civilized crowd. The Host gave him chance to speak, he started his speech by saying “Some Congress people started beating some JD(S) worker … … “, the host objected him saying that, this stage cannot be used for personal comments… he got more nervous and started giving only yes or no answers to the host for all his questions, in fact all ignored him, cause not right person for our area.
Then came BJP candidate Mr. Ramachandra, "late again". He has hold on BEML layout because he has done some work, which is at least well recognized with citizens out there, he is a B.Com Graduate. Not much to comment on him, an average guy, normal Indian politician, kind of civilized. His talk about our area was sensible enough; though not much plausible. Next Congress Guy Mr. Rajkumar, well-known person in Ideal Homes, has done some work in our Ideal homes as I stay there. Don't know about his qualification, but sensible enough in his talks although he went very long in his speech which was rather annoying. I rate BJP and Congress candidates equally.
By this perception I am going for the voting booth and I end this letter… GOD BLESS BENGALURU…
For know about candidates in your area plz follow the link:
http://bangalore.citizenmatters.in/bbmp-2010-candidates
Note: I am not a professional Writer or Blogger… New to blogging please desolate my English.
Let me start… The time for the program to start was 7:30 but as usual it started by 8:15… One thing I got disappointed was, I could not see much youngster out there except few and in that many were reports, journalists and students, however my area is filled by highly qualified and educated people and I was happy to see them all. I attended this debate so I could decide whom I could vote in the upcoming BBMP election.
Well let me give some information about the participants in the debate. By sharp 7:30 I could only see one contender that is Dr. Shankara Prasad from Loksatta Party, very interesting guy and want to say few words about him. His qualification is M.Tech in Materials Engineering from IIT-Kanpur, PH.D in Materials Science and engineering from Sate University of New York, USA. He is a Managing Director in Inkroma E-Business Solution, Bangalore. He is into E-Governance Software. He was very proud about him staying and working in 8 countries (he stressed this many times)... his manifesto for our ward was splendid… like installing community portal and internet Kiosks for easy access to RR Nagar ward, information such as Finance, Accounts, Projects, etc. Personally I felt that he forgot he is in India… for present India his views are too high to accept. He wants to bring American kind of governance in India… RR Nagar ward do not only contains Ideal Homes and BEML layout where highly educated people like but areas like, Bangarappa Hil, Nayandahalli, etc… where still uneducated live who are still unaware of Computer and its applications. We can’t bring all the rules that they follow in USA... some of the things are not suitable on this soil even for Indian civilized community. But in future after many years, yes we do like to be ruled by these kind of people.
Well after few minutes of Dr. Shankara Prasad’s speech, there entered JD(S) candidate, Mr. V Govind Raju… He came to the site with his "gang", they looked bit rowdy, kind of uncivilized... even contender seemed to be the same, however he was bit nervous to speak after seeing the civilized crowd. The Host gave him chance to speak, he started his speech by saying “Some Congress people started beating some JD(S) worker … … “, the host objected him saying that, this stage cannot be used for personal comments… he got more nervous and started giving only yes or no answers to the host for all his questions, in fact all ignored him, cause not right person for our area.
Then came BJP candidate Mr. Ramachandra, "late again". He has hold on BEML layout because he has done some work, which is at least well recognized with citizens out there, he is a B.Com Graduate. Not much to comment on him, an average guy, normal Indian politician, kind of civilized. His talk about our area was sensible enough; though not much plausible. Next Congress Guy Mr. Rajkumar, well-known person in Ideal Homes, has done some work in our Ideal homes as I stay there. Don't know about his qualification, but sensible enough in his talks although he went very long in his speech which was rather annoying. I rate BJP and Congress candidates equally.
By this perception I am going for the voting booth and I end this letter… GOD BLESS BENGALURU…
For know about candidates in your area plz follow the link:
http://bangalore.citizenmatters.in/bbmp-2010-candidates
Note: I am not a professional Writer or Blogger… New to blogging please desolate my English.
Friday, March 26, 2010
Coca-Cola Powered Nokia Mobile Phone - Its Truly Amazing Mobile Phone
Chinese designer Daizi Zheng has created a conceptual mobile phone for Finnish brand Nokia that could be powered by sugary drinks.
Zheng proposes that the phone could run on a battery that uses enzymes to generate electricity from carbohydrates.
The following text is from Daizi Zheng:– "Eco-friendly phone for Nokia. This is a client project for designing an eco friendly phone for Nokia. Through out my research, I found that phone battery as a power source, it is expensive, consuming valuable resources on manufacturing, presenting a disposal problem and harmful to the environment."
The concept is using bio battery to replace the traditional battery to create a pollution free environment.
Bio battery is an ecologically friendly energy generates electricity from carbohydrates (currently sugar) and utilizes enzymes as the catalyst.
By using bio battery as the power source of the phone, it only needs a pack of sugary drink and it generates water and oxygen while the battery dies out.
Bio battery has the potential to operate three to four times longer on a single charge than conventional lithium batteries and it could be fully biodegradable.
Zheng proposes that the phone could run on a battery that uses enzymes to generate electricity from carbohydrates.
The following text is from Daizi Zheng:– "Eco-friendly phone for Nokia. This is a client project for designing an eco friendly phone for Nokia. Through out my research, I found that phone battery as a power source, it is expensive, consuming valuable resources on manufacturing, presenting a disposal problem and harmful to the environment."
The concept is using bio battery to replace the traditional battery to create a pollution free environment.
Bio battery is an ecologically friendly energy generates electricity from carbohydrates (currently sugar) and utilizes enzymes as the catalyst.
By using bio battery as the power source of the phone, it only needs a pack of sugary drink and it generates water and oxygen while the battery dies out.
Bio battery has the potential to operate three to four times longer on a single charge than conventional lithium batteries and it could be fully biodegradable.
Wednesday, March 24, 2010
Knowing the mind of God: Seven theories of everything
The "theory of everything" is one of the most cherished dreams of science. If it is ever discovered, it will describe the workings of the universe at the most fundamental level and thus encompass our entire understanding of nature. It would also answer such enduring puzzles as what dark matter is, the reason time flows in only one direction and how gravity works. Small wonder that Stephen Hawking famously said that such a theory would be "the ultimate triumph of human reason – for then we should know the mind of God".
For full story follow the below link...
http://www.newscientist.com/article/dn18612-knowing-the-mind-of-god-seven-theories-of-everything.html?full=true
For full story follow the below link...
http://www.newscientist.com/article/dn18612-knowing-the-mind-of-god-seven-theories-of-everything.html?full=true
Virtual ears help architects cut chatter confusion
ARCHITECTS aiming to create rooms with crowd-pleasing acoustics could soon rely on a pair of virtual ears to sound out their designs.
I wonder we had this in our college....
read the blog in the link given below...
http://www.newscientist.com/article/mg20527524.200-virtual-ears-help-architects-cut-chatter-confusion.html
I wonder we had this in our college....
read the blog in the link given below...
http://www.newscientist.com/article/mg20527524.200-virtual-ears-help-architects-cut-chatter-confusion.html
Tuesday, March 23, 2010
March 23, 1857: Mr. Otis Gives You a Lift
Mr. Otis was the first to build commercial passenger elevator. The best part was not only it takes passenger up but also down with out free fall, which was very net in the year 1857(hydraulic elevators were in use). This convinced the success.
How to enable running .aspx file on IIS in XP
Hi All,
We need to register .aspx pages before running .aspx page else it will not recognize .aspx pages.
Below a simple command will solve the problem.
Just copy the command and paste it at start->run or Dos….
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
We need to register .aspx pages before running .aspx page else it will not recognize .aspx pages.
Below a simple command will solve the problem.
Just copy the command and paste it at start->run or Dos….
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_regiis.exe -i
Me Bot: A Tele-Presence That Won’t Be Ignored
Will tele-presence robots conduct the quintessential office meeting of the future? If so, will they be able to pay closer attention to the boring details of business conferences than their human counterparts?
On-site avatar machines as tools of communication may well be part of the wave of the corporate future. It is, after all, difficult to ignore a presence when it is perched on a colleague’s shoulder and incessantly waving for your attention.
The Me Bot is the brainchild of MIT doctoral student, Sigurdur Orn. Created with the ability to express itself through gestures, this robot communicates immediately and more effectively than a simple email or even a phone call. “Socially embodied communication” is the term Orn uses to describe the capabilities of this mobile tele-presence.
The photo below is from Orn’s personal collection.
In keeping with Japan’s obsessive love of all things mechanical and robots in particular, the Me Bot made an appearance at the recent Human-Robot Interaction conference in Osaka. The user’s face and two moving arms are displayed via a small screen that sits on top of a three-axis neck.
The arms are what enables Me Bot to express itself and although they seem to be manually controlled, it is the moving screen that translates the user’s head movements into nodding or shaking while the bot moves around on its wheeled base.
“Results show that people feel more psychologically involved and more engaged in the interaction with their remote partners when they are embodied in a socially expressive way. People also reported much higher levels of cooperation both on their own part and their partners as well as a higher score for enjoyment in the interaction,” claims the MIT Personal Robots Group (PRG).
While it does seem unlikely that Me Bots will ever take three-hour executive lunches and dictate unreasonable policies and deadlines as capably as their human counterparts, they may well have found their place in the world of business meetings where everyone is two steps ahead of the item currently being either presented or ignored on the agenda.
What do YOU think about this?
On-site avatar machines as tools of communication may well be part of the wave of the corporate future. It is, after all, difficult to ignore a presence when it is perched on a colleague’s shoulder and incessantly waving for your attention.
The Me Bot is the brainchild of MIT doctoral student, Sigurdur Orn. Created with the ability to express itself through gestures, this robot communicates immediately and more effectively than a simple email or even a phone call. “Socially embodied communication” is the term Orn uses to describe the capabilities of this mobile tele-presence.
The photo below is from Orn’s personal collection.
In keeping with Japan’s obsessive love of all things mechanical and robots in particular, the Me Bot made an appearance at the recent Human-Robot Interaction conference in Osaka. The user’s face and two moving arms are displayed via a small screen that sits on top of a three-axis neck.
The arms are what enables Me Bot to express itself and although they seem to be manually controlled, it is the moving screen that translates the user’s head movements into nodding or shaking while the bot moves around on its wheeled base.
“Results show that people feel more psychologically involved and more engaged in the interaction with their remote partners when they are embodied in a socially expressive way. People also reported much higher levels of cooperation both on their own part and their partners as well as a higher score for enjoyment in the interaction,” claims the MIT Personal Robots Group (PRG).
While it does seem unlikely that Me Bots will ever take three-hour executive lunches and dictate unreasonable policies and deadlines as capably as their human counterparts, they may well have found their place in the world of business meetings where everyone is two steps ahead of the item currently being either presented or ignored on the agenda.
What do YOU think about this?
Monday, March 22, 2010
Channeling Earth: Rivers Seen From Space
Irrawaddy River, Myanmar
The Irrawaddy River splinters into several outlets in its delta on the Bay of Bengal, creating the ideal environment for mangroves. However, a lot of the mangroves have been cleared for rice cultivation, leaving the coastline without the natural protection of these partially submerged forests. Since this image was captured by the Landsat 7 satellite in 2000, even more mangroves have disappeared and in 2008, Cyclone Nargis brought a 12-foot storm surge that devastated the area, threatening the country’s food supply.
Alluvial Fan, Tibet
Lake Morari on the Tibetan Plateau is fed by a glacial river that has formed a dramatic apron of sediment, known as an alluvial fan, over the years. The fan grew big enough to damn the river and form the lake. The water must go back around and through the fan sediments to drain through the lake’s outlet on the left side of this image, taken by astronauts aboard the International Space Station in 2006.
Ganges River, India
The false color image of the Ganges River Delta was taken in 2000 by the Landsat 7 satellite. Bare, sandy soil appears white in the image, and the swamp forests of the region, home to the Royal Bengal Tiger, show up as green. The 1,560-mile-long river originates in the Himalayas and flows across the Uttarakhand state of India to the Bay of Bengal
Mississippi River
Over the past 10,000 years, the Mississippi River has wandered along 200 miles of coastline, switching to a new outlet into the Gulf of Mexico every thousand years or so. Left alone, it would continue to move. Holding it in place is one of the Army Corps of Engineers’ most impressive feats. The Mississippi is the biggest river in the United States, stretching 2,320 miles.
The image above, taken by the Landsat 7 satellite in 2001, shows the Birdfoot Delta, which the river has inhabited for around 600 years and measures more than 31 miles across. The image below, taken by GeoEye’s Ikonos satellite, shows the river after it broke at least two levees in June 2008, flooding the city of Gulfport, Illinois.
Read More http://www.wired.com/wiredscience/2010/03/gallery-rivers/2/#ixzz0isYvTNbe
Thursday, March 18, 2010
Tech Blog by Amit Agarwal
Hi All,
I came across this tech blog today, more the tech blog, it makes your boring life much happening and style. Click on the below link….
http://www.labnol.org/
I came across this tech blog today, more the tech blog, it makes your boring life much happening and style. Click on the below link….
http://www.labnol.org/
Wednesday, March 17, 2010
Editable Grid View
Editable Grid View
Here I will show you how to make use of editable property of Grid View in ASP.NET using C#.
I am new to ASP.NET and my project demanded for editable Grid View. As normal I used Google search engine but it was tough to understand.
Here I am writing how to use Grid view Edit (Update) and delete data from Grid View which is bound with SQL Server.
What you should know:
You should know basic operation of Grid view Control i.e. how to bound grid view with Database.
Let us start…..
Open visual basic and adopt for C# web project, web application (.aspx). Add Grid control to default.aspx page. The initial HTML file look as below.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>
Look for property window and select Grid View. Click on Split view.
In the property window keep AutoGenerateColumns to false and keep AutoGenerateDeleteButton, AutoGenerateEditButton to True. Click on event (which has ligthening mark) in the property window. Double click on RowUpdating, RowEditing, RowDeleting and RowCanceling. In Default .aspx.cs file the function for the row updating, deleting, canceling and deleinting methods will be created as below.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace gridexample
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
}
}
}
Now we can add deletion code in Row Deleting method, Updating code in Row Update method etc…
Sample code for deletion and updating is given below. Here I have taken travel database and CT_Travel table to get data from database and to delete or update the row. Accordingly the HTML pages also changed.
The HTML looks as below:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr>
<td>
<asp:Button ID="ExcelButton" runat="server" Text="Export To Excel"
onclick="ExcelButton_Click" />
</td>
</tr>
<tr>
<asp:GridView ID="DataGridView" runat="server" CellPadding="3" BackColor="#DEBA84"
BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellSpacing="2"
AutoGenerateColumns="False" AutoGenerateEditButton="True"
onrowcancelingedit="DataGridView_RowCancelingEdit"
onrowediting="DataGridView_RowEditing"
onrowupdating="DataGridView_RowUpdating" AutoGenerateDeleteButton="True"
onrowdeleting="DataGridView_RowDeleting">
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:TemplateField HeaderText="Quater">
<ItemTemplate><%# Eval("Q") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date">
<ItemTemplate ><%# Eval("Date_Travle") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Days">
<ItemTemplate ><%# Eval("no_of_days") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Site">
<ItemTemplate ><asp:Label ID="siteid" runat="server" Text='<%# Eval("site") %>'></asp:Label></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="State">
<ItemTemplate ><%# Eval("state") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Country">
<ItemTemplate ><%# Eval("country") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Travellar">
<ItemTemplate ><asp:Label ID="travellar" runat="server" Text='<%# Eval("traveller") %>'></asp:Label></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Manager">
<ItemTemplate ><%# Eval("P_S_Man") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Project/Function">
<ItemTemplate ><%# Eval("P_F") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Purpose">
<ItemTemplate ><%# Eval("purpose") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Category">
<ItemTemplate ><%# Eval("category") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cost in $">
<ItemTemplate ><%# Eval("Aprox_Cost") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PGM">
<ItemTemplate ><%# Eval("PGM") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status">
<ItemTemplate ><%# Eval("Status") %></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Status" runat="server" Text=' <%# Eval("Status") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="GM_Appr">
<ItemTemplate ><%# Eval("GM_Appr") %></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="GM_Appr" runat="server" Text=' <%# Eval("GM_Appr") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</tr>
</table>
</asp:Content>
The code page (default.aspx.cs) looks as:
namespace Travel
{
public partial class DataSheet : System.Web.UI.Page
{
string dept_name;
DataSet ds = new DataSet();
DataView dv = new DataView();
protected void Page_Load(object sender, EventArgs e)
{
dept_name = Request.QueryString["Dept"].ToString();
if (!IsPostBack)
{
bind();
}
}
public void bind()
{
if (dept_name == "All Team")
{
DataGridView.DataSource = getDatagridAll();
Page.DataBind();
}
else
{
DataGridView.DataSource = getDatagrid(dept_name);
Page.DataBind();
}
}
public DataView getDatagrid(string s_name)
{
ds = Travel.Connection.connection.getDataSheet(s_name);
dv = ds.Tables[0].DefaultView;
return dv;
}
public DataView getDatagridAll()
{
ds = Travel.Connection.connection.getDataSheetAll();
dv = ds.Tables[0].DefaultView;
return dv;
}
protected void ExcelButton_Click(object sender, EventArgs e)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Travel status_" + dept_name + ".xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving than
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataGridView.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
// Confirms that an HtmlForm control is rendered for the
//specified ASP.NET server control at run time.
}
protected void DataGridView_RowEditing(object sender, GridViewEditEventArgs e)
{
DataGridView.EditIndex = e.NewEditIndex;
bind();
}
protected void DataGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = (GridViewRow)DataGridView.Rows[e.RowIndex];
Label siteid = (Label)row.FindControl("siteid");
Label travellar = (Label)row.FindControl("travellar");
TextBox Ststus = (TextBox)row.FindControl("Status");
TextBox GM_Appr = (TextBox)row.FindControl("GM_Appr");
DataGridView.EditIndex = -1;
SqlConnection DataConn = new SqlConnection("user id=travel;" + "pwd=travel;" + "Server=servername;" + "Trusted_Connection=yes;" + "database=travel;" + "connection timeout=30");
DataConn.Open();
SqlCommand DataCmd = new SqlCommand("update dbo.CT_Travel set Status = '" + Ststus.Text + "', GM_Appr = '" + GM_Appr.Text + "' where site = '" + siteid.Text + "' and traveller = '" + travellar.Text + "'", DataConn);
DataCmd.ExecuteNonQuery();
DataConn.Close();
bind();
}
protected void DataGridView_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
DataGridView.EditIndex = -1;
bind();
}
protected void DataGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
GridViewRow row = (GridViewRow)DataGridView.Rows[e.RowIndex];
Label siteid = (Label)row.FindControl("siteid");
Label travellar = (Label)row.FindControl("travellar");
SqlConnection DataConn = new SqlConnection("user id=travel;" + "pwd=travel;" + "Server=servername;" + "Trusted_Connection=yes;" + "database=travel;" + "connection timeout=30");
DataConn.Open();
SqlCommand DataCmd = new SqlCommand("delete from dbo.CT_Travel where site = '" + siteid.Text + "' and traveller = '" + travellar.Text + "'", DataConn);
DataCmd.ExecuteNonQuery();
DataConn.Close();
bind();
}
}
}
Here I will show you how to make use of editable property of Grid View in ASP.NET using C#.
I am new to ASP.NET and my project demanded for editable Grid View. As normal I used Google search engine but it was tough to understand.
Here I am writing how to use Grid view Edit (Update) and delete data from Grid View which is bound with SQL Server.
What you should know:
You should know basic operation of Grid view Control i.e. how to bound grid view with Database.
Let us start…..
Open visual basic and adopt for C# web project, web application (.aspx). Add Grid control to default.aspx page. The initial HTML file look as below.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
</div>
</form>
</body>
</html>
Look for property window and select Grid View. Click on Split view.
In the property window keep AutoGenerateColumns to false and keep AutoGenerateDeleteButton, AutoGenerateEditButton to True. Click on event (which has ligthening mark) in the property window. Double click on RowUpdating, RowEditing, RowDeleting and RowCanceling. In Default .aspx.cs file the function for the row updating, deleting, canceling and deleinting methods will be created as below.
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
namespace gridexample
{
public partial class WebForm1 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void GridView1_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
}
protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
}
protected void GridView1_RowEditing(object sender, GridViewEditEventArgs e)
{
}
protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
}
}
}
Now we can add deletion code in Row Deleting method, Updating code in Row Update method etc…
Sample code for deletion and updating is given below. Here I have taken travel database and CT_Travel table to get data from database and to delete or update the row. Accordingly the HTML pages also changed.
The HTML looks as below:
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<table>
<tr>
<td>
<asp:Button ID="ExcelButton" runat="server" Text="Export To Excel"
onclick="ExcelButton_Click" />
</td>
</tr>
<tr>
<asp:GridView ID="DataGridView" runat="server" CellPadding="3" BackColor="#DEBA84"
BorderColor="#DEBA84" BorderStyle="None" BorderWidth="1px" CellSpacing="2"
AutoGenerateColumns="False" AutoGenerateEditButton="True"
onrowcancelingedit="DataGridView_RowCancelingEdit"
onrowediting="DataGridView_RowEditing"
onrowupdating="DataGridView_RowUpdating" AutoGenerateDeleteButton="True"
onrowdeleting="DataGridView_RowDeleting">
<RowStyle BackColor="#FFF7E7" ForeColor="#8C4510" />
<FooterStyle BackColor="#F7DFB5" ForeColor="#8C4510" />
<PagerStyle ForeColor="#8C4510" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="White" />
<HeaderStyle BackColor="#A55129" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:TemplateField HeaderText="Quater">
<ItemTemplate><%# Eval("Q") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Date">
<ItemTemplate ><%# Eval("Date_Travle") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Days">
<ItemTemplate ><%# Eval("no_of_days") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Site">
<ItemTemplate ><asp:Label ID="siteid" runat="server" Text='<%# Eval("site") %>'></asp:Label></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="State">
<ItemTemplate ><%# Eval("state") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Country">
<ItemTemplate ><%# Eval("country") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Travellar">
<ItemTemplate ><asp:Label ID="travellar" runat="server" Text='<%# Eval("traveller") %>'></asp:Label></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Manager">
<ItemTemplate ><%# Eval("P_S_Man") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Project/Function">
<ItemTemplate ><%# Eval("P_F") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Purpose">
<ItemTemplate ><%# Eval("purpose") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Category">
<ItemTemplate ><%# Eval("category") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cost in $">
<ItemTemplate ><%# Eval("Aprox_Cost") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="PGM">
<ItemTemplate ><%# Eval("PGM") %></ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Status">
<ItemTemplate ><%# Eval("Status") %></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="Status" runat="server" Text=' <%# Eval("Status") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="GM_Appr">
<ItemTemplate ><%# Eval("GM_Appr") %></ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="GM_Appr" runat="server" Text=' <%# Eval("GM_Appr") %>'></asp:TextBox>
</EditItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</tr>
</table>
</asp:Content>
The code page (default.aspx.cs) looks as:
namespace Travel
{
public partial class DataSheet : System.Web.UI.Page
{
string dept_name;
DataSet ds = new DataSet();
DataView dv = new DataView();
protected void Page_Load(object sender, EventArgs e)
{
dept_name = Request.QueryString["Dept"].ToString();
if (!IsPostBack)
{
bind();
}
}
public void bind()
{
if (dept_name == "All Team")
{
DataGridView.DataSource = getDatagridAll();
Page.DataBind();
}
else
{
DataGridView.DataSource = getDatagrid(dept_name);
Page.DataBind();
}
}
public DataView getDatagrid(string s_name)
{
ds = Travel.Connection.connection.getDataSheet(s_name);
dv = ds.Tables[0].DefaultView;
return dv;
}
public DataView getDatagridAll()
{
ds = Travel.Connection.connection.getDataSheetAll();
dv = ds.Tables[0].DefaultView;
return dv;
}
protected void ExcelButton_Click(object sender, EventArgs e)
{
Response.Clear();
Response.AddHeader("content-disposition", "attachment;filename=Travel status_" + dept_name + ".xls");
Response.Charset = "";
// If you want the option to open the Excel file without saving than
// comment out the line below
// Response.Cache.SetCacheability(HttpCacheability.NoCache);
Response.ContentType = "application/vnd.xls";
System.IO.StringWriter stringWrite = new System.IO.StringWriter();
System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
DataGridView.RenderControl(htmlWrite);
Response.Write(stringWrite.ToString());
Response.End();
}
public override void VerifyRenderingInServerForm(Control control)
{
// Confirms that an HtmlForm control is rendered for the
//specified ASP.NET server control at run time.
}
protected void DataGridView_RowEditing(object sender, GridViewEditEventArgs e)
{
DataGridView.EditIndex = e.NewEditIndex;
bind();
}
protected void DataGridView_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
GridViewRow row = (GridViewRow)DataGridView.Rows[e.RowIndex];
Label siteid = (Label)row.FindControl("siteid");
Label travellar = (Label)row.FindControl("travellar");
TextBox Ststus = (TextBox)row.FindControl("Status");
TextBox GM_Appr = (TextBox)row.FindControl("GM_Appr");
DataGridView.EditIndex = -1;
SqlConnection DataConn = new SqlConnection("user id=travel;" + "pwd=travel;" + "Server=servername;" + "Trusted_Connection=yes;" + "database=travel;" + "connection timeout=30");
DataConn.Open();
SqlCommand DataCmd = new SqlCommand("update dbo.CT_Travel set Status = '" + Ststus.Text + "', GM_Appr = '" + GM_Appr.Text + "' where site = '" + siteid.Text + "' and traveller = '" + travellar.Text + "'", DataConn);
DataCmd.ExecuteNonQuery();
DataConn.Close();
bind();
}
protected void DataGridView_RowCancelingEdit(object sender, GridViewCancelEditEventArgs e)
{
DataGridView.EditIndex = -1;
bind();
}
protected void DataGridView_RowDeleting(object sender, GridViewDeleteEventArgs e)
{
GridViewRow row = (GridViewRow)DataGridView.Rows[e.RowIndex];
Label siteid = (Label)row.FindControl("siteid");
Label travellar = (Label)row.FindControl("travellar");
SqlConnection DataConn = new SqlConnection("user id=travel;" + "pwd=travel;" + "Server=servername;" + "Trusted_Connection=yes;" + "database=travel;" + "connection timeout=30");
DataConn.Open();
SqlCommand DataCmd = new SqlCommand("delete from dbo.CT_Travel where site = '" + siteid.Text + "' and traveller = '" + travellar.Text + "'", DataConn);
DataCmd.ExecuteNonQuery();
DataConn.Close();
bind();
}
}
}
Subscribe to:
Posts (Atom)















