in the Button1_Click I need to make the 1st column saved as readonly.
How can I do this?
using System;
using System.Collecti ons;
using System.Componen tModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.Sess ionState;
using System.Web.UI;
using System.Web.UI.W ebControls;
using System.Web.UI.H tmlControls;
using System.Data.Sql Client;
using System.Xml.Xsl;
using System.Xml;
namespace PDM.excel
{
/// <summary>
/// Summary description for WebForm3.
/// </summary>
public class WebForm3 : System.Web.UI.P age
{
protected System.Web.UI.W ebControls.Data Grid DataGrid1;
public SqlConnection conDB = new SqlConnection() ;
static public string[] LanguageStr =
{
"English","Fren ch","Spanish" };
static public string[] DropDownListStr =
{
"Language_DropD ownList"};
protected System.Web.UI.W ebControls.Drop DownList
Language_DropDo wnList;
protected System.Web.UI.W ebControls.Labe l Label1;
protected System.Web.UI.W ebControls.Butt on Button1;
static public string[][] AddStrArray =
{
LanguageStr};
private void Fill_DropDownLi st()
{
for (int i = 0; i < DropDownListStr .Length; i++)
{
string CtrlName= DropDownListStr[i];
DropDownList MyList =
(DropDownList)P age.FindControl (CtrlName);
// Populate all the checkboxes
string[] ToPopulate = AddStrArray[i];
for (int j = 0; j < ToPopulate.Leng th; j++)
{
MyList.Items.Ad d(new ListItem(ToPopu late[j],
j.ToString()));
}
}
}
private void Page_Load(objec t sender, System.EventArg s e)
{
// Put user code to initialize the page here
if(!Page.IsPost Back)
{
Fill_DropDownLi st();
}
}
#region Web Form Designer generated code
override protected void OnInit(EventArg s e)
{
//
// CODEGEN: This call is required by the ASP.NET Web Form
Designer.
//
InitializeCompo nent();
base.OnInit(e);
}
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeCompo nent()
{
this.Language_D ropDownList.Sel ectedIndexChang ed += new
System.EventHan dler(this.Langu age_DropDownLis t_SelectedIndex Changed);
this.Button1.Cl ick += new
System.EventHan dler(this.Butto n1_Click);
this.Load += new System.EventHan dler(this.Page_ Load);
}
#endregion
public DataSet DataToExcel = new DataSet();
private void Language_DropDo wnList_Selected IndexChanged(ob ject
sender, System.EventArg s e)
{
int getSelectedInde x = Language_DropDo wnList.Selected Index+1;
conDB.Connectio nString = "data
source=10.195.1 7.7;database=de vnew;uid=bounaa jak;pwd=ehsfirs t;packet
size=4096";
SqlDataAdapter da = new SqlDataAdapter( "Select string_id,
string from pdm_translation s where language_id = 1 and string_id not in
(select string_id from pdm_translation s where language_id = " +
getSelectedInde x.ToString() + ") ", conDB);
da.Fill(DataToE xcel, "DataToExce l");
Session["Tabla"] = Language_DropDo wnList.Selected Item.Text;
DataToExcel.Wri teXml(Server.Ma pPath(Session["Tabla"] +
".xml"));
DataGrid1.DataS ource = DataToExcel;
DataGrid1.DataB ind();
Language_DropDo wnList.Visible = false;
}
private void Button1_Click(o bject sender, System.EventArg s e)
{
Response.Conten tType = "applicatio n/vnd.ms-excel";
Response.Charse t = "";
DataSet ds = new DataSet();
ds.ReadXml(Serv er.MapPath(Sess ion["Tabla"] + ".xml"));
XmlDataDocument xdd = new XmlDataDocument (ds);
XslTransform xt = new XslTransform();
xt.Load(Server. MapPath("Excel. xsl"));
xt.Transform(xd d, null, Response.Output Stream);
Response.End();
}
}
}
--
LUIS ESTEBAN VALENCIA
MICROSOFT DCE 3.
MIEMBRO ACTIVO DE ALIANZADEV
http://spaces.msn.com/members/extremed/