Click here to Skip to main content
15,914,905 members
Home / Discussions / Web Development
   

Web Development

 
GeneralRe: CSS problems [modified] Pin
Shog931-May-06 4:19
sitebuilderShog931-May-06 4:19 
GeneralRe: CSS problems [modified] Pin
Megan Forbes31-May-06 12:55
Megan Forbes31-May-06 12:55 
AnswerRe: CSS problems [modified] Pin
Richard Parsons31-May-06 11:33
Richard Parsons31-May-06 11:33 
GeneralRe: CSS problems [modified] Pin
Megan Forbes31-May-06 12:54
Megan Forbes31-May-06 12:54 
QuestionChange HTML element style in webbrowser2 Pin
marxafd27-May-06 15:01
marxafd27-May-06 15:01 
QuestionUpdate DataGrid -asp.net Pin
Zuhair Rizvi27-May-06 11:27
Zuhair Rizvi27-May-06 11:27 
Generalput your code here Pin
Reza Raad27-May-06 22:10
Reza Raad27-May-06 22:10 
GeneralRe: put your code here Pin
Zuhair Rizvi28-May-06 12:15
Zuhair Rizvi28-May-06 12:15 
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using System.IO;
using System.Globalization;

namespace WebApplication4
{
///
/// Summary description for properties.
///

public class properties : System.Web.UI.Page
{
protected System.Web.UI.WebControls.DataGrid DataGrid1;

protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Label Label2;
protected System.Web.UI.WebControls.Image Image1;
public DataView dv;
public SqlConnection conn;
public SqlDataAdapter da=new SqlDataAdapter();
public DataSet ds=new DataSet();

public void Page_Load(object sender, System.EventArgs e)
{

// Put user code to initialize the page here
Label1.Text=User.Identity.Name;
string strConnection =" Integrated Security=SSPI;";
strConnection += "initial catalog=dbREO;server=DCSIAN;";
strConnection += "Connect Timeout=30";

conn = new SqlConnection (strConnection);
conn.Open ();

da=new SqlDataAdapter("SELECT * FROM tblCommercialProperty WHERE ID= '" + Label1.Text+ "' " ,conn);
da.Fill(ds,"tblCommercialProperty");
DataGrid1.DataSource=ds.Tables["tblCommercialProperty"];
DataGrid1.DataBind();
}

public void DataGrid1_SelectedIndexChanged(object sender,System.EventArgs e)
{
DataGridItem dgi = ((DataGrid)sender).SelectedItem;
}

#region Web Form Designer generated code
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form Designer.
//
InitializeComponent();
base.OnInit(e);
}

///
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
///

private void InitializeComponent()
{
this.DataGrid1.CancelCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_CancelCommand);
this.DataGrid1.EditCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_EditCommand);
this.DataGrid1.SortCommand += new System.Web.UI.WebControls.DataGridSortCommandEventHandler(this.DataGrid1_SortCommand);
this.DataGrid1.UpdateCommand += new System.Web.UI.WebControls.DataGridCommandEventHandler(this.DataGrid1_UpdateCommand);
this.Load += new System.EventHandler(this.Page_Load);

}
#endregion

public void DataGrid1_EditCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DataGrid1.EditItemIndex=e.Item.ItemIndex;
DataGrid1.DataBind();
}

public void DataGrid1_CancelCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DataGrid1.EditItemIndex=-1;
DataGrid1.DataBind();
}

public void DataGrid1_UpdateCommand(object source, System.Web.UI.WebControls.DataGridCommandEventArgs e)
{
DataTable dt=new DataTable();
DataRow dr;
dt=ds.Tables["tblCommercialProperty"];
dr=dt.Rows[0];

//I m not using (TextBox)e.item.FindControl because my sql query gives me the single row which have ID=Label1
//The problem is that these cells write actual values in database,i want edited values
//Updation is working correctly because when i move one column's value into another it updates that

dr["CoveredArea"]=((TextBox)e.Item.Cells[3].Controls[0]).Text;
dr["Location"]=((TextBox)e.Item.Cells[4].Controls[0]).Text;
dr["Area"]=((TextBox)e.Item.Cells[5].Controls[0]).Text;
dr["OtherDetails"]=((TextBox)e.Item.Cells[6].Controls[0]).Text;
dr["Status"]=((TextBox)e.Item.Cells[8].Controls[0]).Text;

SqlCommandBuilder cmd=new SqlCommandBuilder(da);
da.Update(ds,"tblCommercialProperty");
DataGrid1.DataSource=ds.Tables["tblCommercialProperty"];
DataGrid1.EditItemIndex=-1;
DataGrid1.DataBind();

}

public void DataGrid1_SortCommand(object source, System.Web.UI.WebControls.DataGridSortCommandEventArgs e)
{
dv.Sort=e.SortExpression;
DataGrid1.DataBind();
}
}
}
AnswerRe: Update DataGrid -asp.net Pin
vkaushik00129-May-06 19:21
vkaushik00129-May-06 19:21 
GeneralRe: Update DataGrid -asp.net Pin
Zuhair Rizvi2-Jun-06 4:11
Zuhair Rizvi2-Jun-06 4:11 
QuestionValidation Control - asp.net Pin
aransiola27-May-06 7:44
aransiola27-May-06 7:44 
AnswerRe: Validation Control - asp.net Pin
Kevin McFarlane27-May-06 11:52
Kevin McFarlane27-May-06 11:52 
Questionis it possible? Pin
maximf26-May-06 21:15
maximf26-May-06 21:15 
AnswerRe: is it possible? Pin
Guffa26-May-06 22:32
Guffa26-May-06 22:32 
GeneralRe: is it possible? Pin
maximf28-May-06 0:36
maximf28-May-06 0:36 
AnswerRe: is it possible? Pin
Guffa28-May-06 11:07
Guffa28-May-06 11:07 
Questionxml and javascripting [modified] Pin
ritu432126-May-06 2:33
ritu432126-May-06 2:33 
QuestionMULTITHREADED DOWNLOAD Pin
lathi26-May-06 1:37
lathi26-May-06 1:37 
AnswerRe: MULTITHREADED DOWNLOAD Pin
darkcloud.42o5-Jun-06 17:00
darkcloud.42o5-Jun-06 17:00 
GeneralRe: MULTITHREADED DOWNLOAD Pin
darkcloud.42o5-Jun-06 17:02
darkcloud.42o5-Jun-06 17:02 
QuestionAssign a js variable to php variable Pin
torniker25-May-06 11:26
torniker25-May-06 11:26 
AnswerRe: Assign a js variable to php variable Pin
alex.barylski25-May-06 13:51
alex.barylski25-May-06 13:51 
GeneralRe: Assign a js variable to php variable Pin
torniker26-May-06 6:15
torniker26-May-06 6:15 
Questioncode for login page Pin
lucky123456025-May-06 8:46
lucky123456025-May-06 8:46 
AnswerRe: code for login page Pin
Gonzalo Brusella26-May-06 6:39
Gonzalo Brusella26-May-06 6:39 

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.