Click here to Skip to main content
15,885,546 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionhow to redirect in a url? Pin
Jassim Rahma17-Jan-13 9:42
Jassim Rahma17-Jan-13 9:42 
AnswerRe: how to redirect in a url? Pin
Parwej Ahamad18-Jan-13 7:17
professionalParwej Ahamad18-Jan-13 7:17 
GeneralRe: how to redirect in a url? Pin
Jassim Rahma18-Jan-13 7:36
Jassim Rahma18-Jan-13 7:36 
GeneralRe: how to redirect in a url? Pin
Parwej Ahamad18-Jan-13 17:23
professionalParwej Ahamad18-Jan-13 17:23 
AnswerRe: how to redirect in a url? Pin
Rekhash18-Jan-13 23:01
Rekhash18-Jan-13 23:01 
QuestionHow to add KML file to google Map using javascript in asp.net Pin
Trivikramarao Vurubandi17-Jan-13 0:40
Trivikramarao Vurubandi17-Jan-13 0:40 
QuestionExport data in Excel(xlsx) without using Excel Object from Datatable. Pin
mca_rameshkumar16-Jan-13 22:00
mca_rameshkumar16-Jan-13 22:00 
AnswerRe: Export data in Excel(xlsx) without using Excel Object from Datatable. Pin
chester_it2118-Jan-13 6:52
chester_it2118-Jan-13 6:52 
Redirect/open window to pageListForExportExcel.aspx in page1.aspx
so in page1 set input button to redirect/open window to pageListForExportExcel.aspx
in page1 :

HTML
<input type="button" value="Export to Excel" onclick="ExportToExcel()"/>

and you need javascript or JQuery for create function redirect/open window to pageListForExportExcel.aspx

JavaScript
<script type="text/javascript">
      function ExportToExcel()
      {
          var txt = window.open("pageListForExportExcel.aspx");
      }
</script>



in ASPX (pageListForExportExcel.aspx), use repeater for display you data from datatable,Example set to be this :
ASP.NET
<%@ Page Language="C#" AutoEventWireup="true" EnableSessionState="ReadOnly" EnableViewState="false" CodeBehind="BukuInduk_exportToExcel.aspx.cs" Inherits="LimSys.Web.Laporan.BukuInduk_exportToExcel" %>
		<asp:Repeater ID="rep1" runat="server">
			<HeaderTemplate>
				<table border=1>
					<tr>
						<td>NAME</td>
						<td>ADDRESS</td>
						<td>TELP</td>
						<td>GENDER</td>
					</tr>
			</HeaderTemplate>
			<ItemTemplate>
					<tr>
						<td><%# Eval("name")%></td>
						<td><%# Eval("address")%></td>
						<td><%# Eval("telp")%></td>
						<td><%# Eval("gender")%></td>
					</tr>
			</ItemTemplate>
			<FooterTemplate>
				</table>
			</FooterTemplate>
		</asp:Repeater>


and the last,in code behind pageListForExportExcel.aspx.cs
use this :

C#
 protected void Page_Load(object sender, EventArgs e)
{
    Response.Clear();// this for clear any response
    Response.Buffer = true; // and then set to Buffer is true
    Response.ContentType = "application/vnd.ms-excel";// and this is for call type what you want to set File extention for save....you can export to pdf ,if you change value Response.ContentType

    var process = new DataLayersCollections();//set here by name your BusinesLogic
    var list = process.GetListFromDataTable(); //set here by name your functions
    rep1.DataSource = list;
    rep1.DataBind();
}


and the latter again .......
good luck ....
hope this help you.....Big Grin | :-D
QuestionButton or ImageButton? Pin
Jassim Rahma16-Jan-13 9:40
Jassim Rahma16-Jan-13 9:40 
AnswerRe: Button or ImageButton? Pin
jkirkerx16-Jan-13 12:40
professionaljkirkerx16-Jan-13 12:40 
QuestionGoogle Translate vb.net Pin
DotNetFellow15-Jan-13 22:31
DotNetFellow15-Jan-13 22:31 
AnswerRe: Google Translate vb.net Pin
Sandeep Mewara16-Jan-13 2:57
mveSandeep Mewara16-Jan-13 2:57 
Questionunzipping file in host ? Pin
jojoba201115-Jan-13 17:59
jojoba201115-Jan-13 17:59 
AnswerRe: unzipping file in host ? Pin
Vani Kulkarni16-Jan-13 2:44
professionalVani Kulkarni16-Jan-13 2:44 
QuestionRe: unzipping file in host ? Pin
jojoba201116-Jan-13 7:41
jojoba201116-Jan-13 7:41 
QuestionProblem with MapPageRoute.. Pin
Jassim Rahma15-Jan-13 10:06
Jassim Rahma15-Jan-13 10:06 
AnswerRe: Problem with MapPageRoute.. Pin
Brij15-Jan-13 17:30
mentorBrij15-Jan-13 17:30 
AnswerRe: Problem with MapPageRoute.. Pin
Richard MacCutchan15-Jan-13 23:02
mveRichard MacCutchan15-Jan-13 23:02 
Questionhow to install downloaded nested master page template??? Pin
Member 876986514-Jan-13 3:25
Member 876986514-Jan-13 3:25 
AnswerRe: how to install downloaded nested master page template??? Pin
Brij15-Jan-13 18:10
mentorBrij15-Jan-13 18:10 
AnswerRe: how to install downloaded nested master page template??? Pin
Sandeep Mewara15-Jan-13 18:19
mveSandeep Mewara15-Jan-13 18:19 
QuestionA strange problem Pin
indian14313-Jan-13 22:00
indian14313-Jan-13 22:00 
AnswerRe: A strange problem Pin
Abhijit Jana14-Jan-13 7:52
professionalAbhijit Jana14-Jan-13 7:52 
GeneralRe: A strange problem Pin
indian14314-Jan-13 13:15
indian14314-Jan-13 13:15 
Questionhow to MapPageRoute this? Pin
Jassim Rahma13-Jan-13 10:48
Jassim Rahma13-Jan-13 10:48 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.