Posted question part of the code, everybody to help me see, here is part of the code of the meter
Protected void GridView1_RowCreated (object sender, GridViewRowEventArgs e)
{
String date1=TextBox1. Text;
String date2=TextBox2. Text;
The switch (" e.R ow. RowType)
{
Case DataControlRowType. Header:
//total header
TableCellCollection tcHeader="e.R ow. Cells;
TcHeader. The Clear ();
//the first row header
TcHeader. Add (new TableHeaderCell ());
TcHeader [0]. The Attributes. The Add (" bgcolor ", "white");
TcHeader [0]. The Attributes. The Add (" BorderColor ", "# 333300");
TcHeader [0]. The Attributes. The Add (" BorderWidth ", "1 px");
TcHeader [0]. The Attributes. The Add (" colspan ", "10");//merge in the first row 10
TcHeader [0]. Text="BRT line traffic platform income statistics & lt;/th>
//the second line header
TcHeader. Add (new TableHeaderCell ());
TcHeader [1]. The Attributes. The Add (" bgcolor ", "white");
TcHeader [1]. The Attributes. The Add (" colspan ", "10");//merge the second row 10
tcHeader [1]. The Text=TextBox1. "~" Text + + TextBox2. Text + "& lt;/th>
.
}
}
The following is the code for the export file
Private void Export1 (the GridView gvUser, string Style, string FileType, string FileName)
{
The Response. ClearContent ();
The Response. The Charset="GB2312";
The Response. ContentEncoding=System. Text.. Encoding UTF8;
The Response. AppendHeader (" the Content - the Disposition ", "legislation; Filename="+ HttpUtility. UrlEncode (filename, System. Text. Encoding. UTF8). The ToString ());
The Response. ContentType=FileType;
//page. The Response. ContentType="application/ms - excel";
Page. EnableViewState=false;
StringWriter sw=new StringWriter ();
HtmlTextWriter hw=new HtmlTextWriter (sw);
//turn off the paging
GvUser. RenderControl (hw);
Response. Write (Style);
Response. Write (sw. ToString ());
//page. The Response. Flush ();
The Response. The End ();
}
If change the red font to tcHeader [1]. The Text="2019-07-01" + "and" + "2019-07-07" + "& lt;/th>
CodePudding user response:
To what is wrong, it is ok to debug, isn't it?CodePudding user response:
TcHeader [1]. The Text=TextBox1. "~" Text + + TextBox2. Text + "& lt;/th>
These two headers to create a statement at the time of export what's the difference
CodePudding user response:
Look to debug the TextBox1. Text has no value?CodePudding user response:
Has a value, the first picture is when debugging on the web page for the query results, everything is all right
The following picture is the export to EXCEL file, the date of the second line is missing
CodePudding user response:
Change:String myText=TextBox1. Text + + TextBox2. "~" Text + "& lt;/th>
TcHeader [1]. The Text=myText;
Here a breakpoint,
TcHeader [1]. The Text=myText;
What see myText value,
Back to the interrupted point? Please press F9
CodePudding user response:
change:
String myText=TextBox1. Text + + TextBox2. "~" Text + "& lt;/th>
TcHeader [1]. The Text=myText;
Here a breakpoint,
TcHeader [1]. The Text=myText;
What see myText value,
Back to the interrupted point? Please press F9
MyText "2019-07-26 ~ 2019-07-26 & lt;/th>
The crux of the problem is that the string myText=TextBox1. "~" Text + + TextBox2. Text + "& lt;/th>
Write die tcHeader [1]. The Text="2019-07-01" + "to" + "2019-07-07" + "& lt;/th>
Displayed on the web, including tcHeader breakpoint query method [1]. The Text values are corresponding to the date of the period, if I can't find the TextBox control the export of the statement read values?
CodePudding user response:
Your TextBox1 not server controls, are you? With server controlsCodePudding user response:
your TextBox1 not server controls, are you? With server controls
TEXTBOX server controls are not to be?
- Related
- Links:
- CodePudding