By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
425,979 Members | 951 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 425,979 IT Pros & Developers. It's quick & easy.

C# and EXCEL question saving a file saving the the first column as read only

P: n/a

in the Button1_Click I need to make the 1st column saved as readonly.

How can I do this?

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.Xml.Xsl;
using System.Xml;

namespace PDM.excel
/// <summary>
/// Summary description for WebForm3.
/// </summary>
public class WebForm3 : System.Web.UI.Page
protected System.Web.UI.WebControls.DataGrid DataGrid1;
public SqlConnection conDB = new SqlConnection();

static public string[] LanguageStr =
static public string[] DropDownListStr =
protected System.Web.UI.WebControls.DropDownList
protected System.Web.UI.WebControls.Label Label1;
protected System.Web.UI.WebControls.Button Button1;

static public string[][] AddStrArray =

private void Fill_DropDownList()
for (int i = 0; i < DropDownListStr.Length; i++)
string CtrlName= DropDownListStr[i];
DropDownList MyList =
// Populate all the checkboxes
string[] ToPopulate = AddStrArray[i];
for (int j = 0; j < ToPopulate.Length; j++)
MyList.Items.Add(new ListItem(ToPopulate[j],

private void Page_Load(object sender, System.EventArgs e)
// Put user code to initialize the page here


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

/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
this.Language_DropDownList.SelectedIndexChanged += new
System.EventHandler(this.Language_DropDownList_Sel ectedIndexChanged);
this.Button1.Click += new
this.Load += new System.EventHandler(this.Page_Load);


public DataSet DataToExcel = new DataSet();

private void Language_DropDownList_SelectedIndexChanged(object
sender, System.EventArgs e)
int getSelectedIndex =
conDB.ConnectionString = "data
source=;database=devnew;uid=bounaajak;p wd=ehsfirst;packet
SqlDataAdapter da = new SqlDataAdapter("Select string_id,
string from pdm_translations where language_id = 1 and string_id not in
(select string_id from pdm_translations where language_id = " +
getSelectedIndex.ToString() + ") ", conDB);
da.Fill(DataToExcel, "DataToExcel");
Session["Tabla"] =
DataToExcel.WriteXml(Server.MapPath(Session["Tabla"] +
DataGrid1.DataSource = DataToExcel;
Language_DropDownList.Visible = false;


private void Button1_Click(object sender, System.EventArgs e)
Response.ContentType = "application/";
Response.Charset = "";
DataSet ds = new DataSet();
ds.ReadXml(Server.MapPath(Session["Tabla"] + ".xml"));
XmlDataDocument xdd = new XmlDataDocument(ds);
XslTransform xt = new XslTransform();
xt.Transform(xdd, null, Response.OutputStream);

*** Sent via Developersdex ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.