Sir,
Very very THANK YOU,
I also want the Header row Sir,
-----------------------------------------------------------------------------------------------------------
Mischa Kroon <[EMAIL PROTECTED]> wrote:
in beginning of code define a variable which holds the column width.
like:
Columnwidth = 30
then when appending to outputstream fill it out to this width.
str.Append(ds.Tables[0].Rows[i][j].ToString().Padright(Columnwidth ));
----- Original Message -----
From: "Nirmal Abraham" <[EMAIL PROTECTED]>
To: "ASP.NET" <[email protected]>
Sent: Monday, September 12, 2005 11:04 AM
Subject: [AspNetAnyQuestionIsOk] DataGrid to Text(Nirmal) : Help me Sir
>
> Help Me Sir :
>
>
>
> The Given Coding :
>
>
>
>
>
> public void Bind1()
>
> {
>
> SqlConnection sqlConnection = new
> SqlConnection("database=Payrull;server=sj2005;uid=sa;pwd=;");
>
>
>
> sqlConnection.Open();
>
>
>
> SqlDataAdapter ada = new SqlDataAdapter("SELECT
> Emp_no,Emp_name,F_Name from Paymast",sqlConnection);
>
>
>
> ds = new DataSet();
>
>
>
> ada.Fill(ds);
>
>
>
> rec.DataSource = ds.Tables[0] ;
>
> rec.DataBind();
>
> {
>
> StringBuilder str = new StringBuilder();
>
>
>
> for(int i=0;i<=ds.Tables[0].Rows.Count - 1; i++)
>
>
>
> {
>
>
>
> for(int j=0;j<=ds.Tables[0].Columns.Count - 1; j++)
>
>
>
> {
>
>
>
> str.Append(ds.Tables[0].Rows[i][j].ToString());
>
>
>
> str.Append(char.ToString('\t'));
>
> str.Append(char.ToString('\t'));
>
> }
>
> str.Append(Environment.NewLine);
>
> }
>
> Response.Clear();
>
>
>
> Response.AddHeader("content-disposition",
> "attachment;filename=FileName.txt");
>
>
>
> Response.Charset = "";
>
>
>
> Response.Cache.SetCacheability(HttpCacheability.NoCache);
>
>
>
> Response.ContentType = "application/vnd.text";
>
>
>
> System.IO.StringWriter stringWrite = new System.IO.StringWriter();
>
>
>
> System.Web.UI.HtmlTextWriter htmlWrite = new HtmlTextWriter(stringWrite);
>
>
>
> rec.RenderControl(htmlWrite);
>
>
>
> Response.Write(str.ToString());
>
>
>
> Response.End();
>
> }
>
> }
>
>
>
> The Output :
>
>
>
> The Ouput is in Irregular Format
>
>
>
> 1 Michael Benjamin
>
> 10 Samuel Arumainayagam K.
>
> 11 Pratheep B.
>
> 11013 Jeyachandran P. Peter Chelliah Y.
>
> 11024 Palani Kumar N. Natarajan
>
> 11035 Selvakumar Samuel A. Aron Durai Pandian
>
> 11046 Jeyaraj J. Joseph
>
> 11057 Chandrasekaran S. Sankaralingam
>
> 11068 Asir Gnanadoss T. Thiagaraj
>
> 11079 Rajendra Prasad S. Sonachalam
>
> 11081 Alphonse D. SMN Fernando
>
> 11092 Latha K. Kaisinth S.
>
> 11103 Balasubramaniam G. Ganapathy
>
> 11114 Vedanayagam P. Paramasivan
>
> 11125 Jeyakumar Thanasing P. Paulraj
> Abraham
>
> 11136 Immanuel K.Jeyaprakash Koilpillai
>
> 11147 Thangaraj R. Rajamany D.
>
> 11158 Selvadurai P.M. Pandiyaraj
>
> 11169 Suriyan S. Subramonian
>
> 11171 Rajendran S. Sathiamurthy
>
> 11182 Jessy Devi G. Gerald P. Rayen
>
> 11193 Meenatchi Sundaram V. Veerabahu
>
> 11204 Subbiah M. Muthiah
>
>
>
>
>
> Sir the Output not in Proper Manner . I Have to arrange in the table form.
>
> But not the table.
>
>
>
> Example : I want the Output Like this
>
>
>
> 101 Nirmal. Manuel.
>
> 102 Sundaram. Arun.
>
> 103 Zion.
>
> 10411 Arun.
>
>
>
> In this Format I want Sir. Please Help me Sir.
>
>
>
> ---------------------------------
> Yahoo! India Matrimony: Find your partner now.
>
> [Non-text portions of this message have been removed]
>
>
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>
SPONSORED LINKS
Basic programming language Computer programming languages Programming languages
Java programming language The history of computer programming language
---------------------------------
YAHOO! GROUPS LINKS
Visit your group "AspNetAnyQuestionIsOk" on the web.
To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service.
---------------------------------
---------------------------------
Yahoo! India Matrimony: Find your partner online.
[Non-text portions of this message have been removed]
------------------------ Yahoo! Groups Sponsor --------------------~-->
Get Bzzzy! (real tools to help you find a job). Welcome to the Sweet Life.
http://us.click.yahoo.com/A77XvD/vlQLAA/TtwFAA/saFolB/TM
--------------------------------------------------------------------~->
Yahoo! Groups Links
<*> To visit your group on the web, go to:
http://groups.yahoo.com/group/AspNetAnyQuestionIsOk/
<*> To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
<*> Your use of Yahoo! Groups is subject to:
http://docs.yahoo.com/info/terms/