Click here to Skip to main content
15,897,334 members
Home / Discussions / C#
   

C#

 
AnswerRe: Where to buy apps and programs from programmers? Pin
Matthew Klein23-Dec-08 13:34
Matthew Klein23-Dec-08 13:34 
GeneralRe: Where to buy apps and programs from programmers? Pin
Christian Graus23-Dec-08 13:38
protectorChristian Graus23-Dec-08 13:38 
QuestionHelp with a pathfinding problem Pin
xnastyx23-Dec-08 10:26
xnastyx23-Dec-08 10:26 
AnswerRe: Help with a pathfinding problem Pin
Not Active23-Dec-08 12:34
mentorNot Active23-Dec-08 12:34 
JokeRe: Help with a pathfinding problem Pin
Luc Pattyn23-Dec-08 14:01
sitebuilderLuc Pattyn23-Dec-08 14:01 
QuestionHow to add data from textboxes to the Gridview in C# Pin
Yasir Imran Uppal23-Dec-08 8:40
Yasir Imran Uppal23-Dec-08 8:40 
AnswerRe: How to add data from textboxes to the Gridview in C# Pin
Christian Graus23-Dec-08 8:52
protectorChristian Graus23-Dec-08 8:52 
AnswerRe: How to add data from textboxes to the Gridview in C# Pin
faizicrazy23-Dec-08 23:28
faizicrazy23-Dec-08 23:28 
Grid.aspx -- Page Design Code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Grid.aspx.cs" Inherits="Grid" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<table style="width: 287px">
<tr>
<td>
<asp:Label ID="lblId" runat="server" Text="Id"></asp:Label></td>
<td>
<asp:TextBox ID="txtId" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblFirstName" runat="server" Text="First Name" Width="71px"></asp:Label></td>
<td>
<asp:TextBox ID="txtFirstName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblLastName" runat="server" Text="Last Name"></asp:Label></td>
<td>
<asp:TextBox ID="txtLastName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblNickName" runat="server" Text="Nick Name"></asp:Label></td>
<td>
<asp:TextBox ID="txtNickName" runat="server"></asp:TextBox></td>
</tr>
<tr>
<td>
<asp:Label ID="lblCity" runat="server" Text="City"></asp:Label></td>
<td>
<asp:TextBox ID="txtCity" runat="server"></asp:TextBox></td>
<td>
<asp:Button ID="btnInsert" runat="server" OnClick="btnInsert_Click" Text="Insert" />
     
</td>
</tr>
</table>

</div>
<br />
<asp:GridView ID="GridView1" runat="server" CellPadding="4" ForeColor="#333333" GridLines="None">
<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
<HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#999999" />
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
</asp:GridView>
</form>
</body>
</html>

Grid.aspx.cs -- Code for Insert Data into Grid

protected void Page_Load(object sender, EventArgs e)
{
if (!Page.IsPostBack)
{
DataTable dt = new DataTable();
dt.Columns.Add("Id", typeof(string));
dt.Columns.Add("First Name", typeof(string));
dt.Columns.Add("Last Name", typeof(string));
dt.Columns.Add("Nick Name", typeof(string));
dt.Columns.Add("City", typeof(string));
VSDataTable = dt.Copy();
}
}

private DataTable VSDataTable
{
get
{
return (DataTable)ViewState["VsDt"];
}
set
{
ViewState["VsDt"] = value;
}
}



protected void btnInsert_Click(object sender, EventArgs e)
{
DataRow dr = VSDataTable.NewRow();
dr["Id"] = txtId.Text;
dr["First Name"] = txtFirstName.Text;
dr["Last Name"] = txtLastName.Text;
dr["Nick Name"] = txtNickName.Text;
dr["City"] = txtCity.Text;
VSDataTable.Rows.Add(dr);
GridView1.DataSource = VSDataTable;
GridView1.DataBind();
ClearTextBoxes();
}
public void ClearTextBoxes()
{
txtId.Text = "";
txtFirstName.Text = "";
txtLastName.Text = "";
txtNickName.Text = "";
txtCity.Text="";
}

Faisal and Prathap
QuestionUpdating Dataset Pin
ArielR23-Dec-08 6:57
ArielR23-Dec-08 6:57 
AnswerRe: Updating Dataset Pin
Dave Kreskowiak23-Dec-08 8:04
mveDave Kreskowiak23-Dec-08 8:04 
GeneralRe: Updating Dataset Pin
ArielR23-Dec-08 8:20
ArielR23-Dec-08 8:20 
AnswerRe: Updating Dataset Pin
Christian Graus23-Dec-08 8:06
protectorChristian Graus23-Dec-08 8:06 
GeneralRe: Updating Dataset Pin
ArielR23-Dec-08 8:30
ArielR23-Dec-08 8:30 
QuestionSerializition!! I want serialize a class Pin
Masterhame23-Dec-08 6:04
Masterhame23-Dec-08 6:04 
AnswerRe: Serializition!! I want serialize a class Pin
EliottA23-Dec-08 6:07
EliottA23-Dec-08 6:07 
AnswerRe: Serializition!! I want serialize a class Pin
Giorgi Dalakishvili23-Dec-08 6:17
mentorGiorgi Dalakishvili23-Dec-08 6:17 
GeneralRe: Serializition!! I want serialize a class Pin
Masterhame23-Dec-08 6:45
Masterhame23-Dec-08 6:45 
GeneralRe: Serializition!! I want serialize a class Pin
Giorgi Dalakishvili23-Dec-08 6:49
mentorGiorgi Dalakishvili23-Dec-08 6:49 
GeneralRe: Serializition!! I want serialize a class Pin
User 665823-Dec-08 8:22
User 665823-Dec-08 8:22 
GeneralRe: Serializition!! I want serialize a class Pin
Colin Angus Mackay23-Dec-08 8:26
Colin Angus Mackay23-Dec-08 8:26 
Question"about:blank" and relative links Pin
Matthew Klein23-Dec-08 5:57
Matthew Klein23-Dec-08 5:57 
QuestionCan we create 16 bit application in .Net Pin
Naveed72723-Dec-08 5:54
Naveed72723-Dec-08 5:54 
AnswerRe: Can we create 16 bit application in .Net Pin
dan!sh 23-Dec-08 6:07
professional dan!sh 23-Dec-08 6:07 
AnswerRe: Can we create 16 bit application in .Net Pin
Christian Graus23-Dec-08 8:01
protectorChristian Graus23-Dec-08 8:01 
AnswerRe: Can we create 16 bit application in .Net Pin
#realJSOP23-Dec-08 8:27
professional#realJSOP23-Dec-08 8:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.