Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > .NET 1.0 and Visual Studio.NET > VS.NET 2002/2003
VS.NET 2002/2003 Discussions about the Visual Studio.NET programming environment, the 2002 (1.0) and 2003 (1.1). ** Please don't post code questions here ** For issues specific to a particular language in .NET, please see the other forum categories.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VS.NET 2002/2003 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
Old January 6th, 2005, 05:33 PM
Authorized User
Join Date: Aug 2004
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to macupryk Send a message via Yahoo to macupryk
Default EXCEL question saving a file saving the the first

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 Language_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 = (DropDownList)Page.FindControl(CtrlName);
                    // Populate all the checkboxes
                    string[] ToPopulate = AddStrArray[i];
                    for (int j = 0; j < ToPopulate.Length; j++)
                         MyList.Items.Add(new ListItem(ToPopulate[j], j.ToString()));

          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 Designer.

          /// <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 System.EventHandler(this.Button1_Click);
               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 = Language_DropDownList.SelectedIndex+1;
               conDB.ConnectionString = "data source=;database=devnew;uid=bounaajak;p wd=ehsfirst;packet size=4096";
               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"] = Language_DropDownList.SelectedItem.Text;
               DataToExcel.WriteXml(Server.MapPath(Session["Tabla"] + ".xml"));
               DataGrid1.DataSource = DataToExcel;
               Language_DropDownList.Visible = false;


          private void Button1_Click(object sender, System.EventArgs e)
               Response.ContentType = "application/vnd.ms-excel";
               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);


Knowledge is to be shared.
Knowledge is to be shared.

Similar Threads
Thread Thread Starter Forum Replies Last Post
Question on saving changes to databases PatCiferri SQL Server 2005 1 December 4th, 2007 04:56 PM
Need help AFTER saving an Excel File amerk20 Excel VBA 5 January 8th, 2007 01:42 PM
Saving Excel File tdaustin Classic ASP Basics 6 December 2nd, 2006 03:38 AM
Saving an excel file in Access VBA theboylatham Access VBA 1 August 19th, 2005 08:14 AM
How To avoid the SAving of toolbars while saving Hari_Word Excel VBA 6 July 26th, 2004 12:13 AM

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.