|
Hi,
You can use this code,it directly exports only the current records of the page
Response.ClearContent()
Response.AddHeader("content-disposition", "attachment;filename="& Your File Name & ".xls")
Response.Charset = ""
Response.ContentType = "application/vnd.xls"
Dim stringWriter As New System.IO.StringWriter()
Dim htmlWrite As New System.Web.UI.HtmlTextWriter(stringWriter)
'dgview is your datagrid
dgview.AllowPaging = true
dgview.DataSource = Your Data Source
dgview.DataBind()
dgview.RenderControl(htmlWrite)
Response.Write(stringWriter.ToString())
Response.End()
and also you can apply some styles for excel sheet....
Hope this will help you...
S Kumar
|
|
|
|
|
Hai,
I am using c# ,and no idea about vb. If some other code or idea is there, pls share.In my code the foreach loop is searching for the whole recods.What should i change there?
foreach (DataRow drow in datatable.Rows)
{
for (j = 0; j < datatable.Columns.Count; j++)
{
if(Headers.Length > k)
{
if(datatable.Columns[j].ColumnName == Headers[k].ToString())
{
if(drow[j].ToString() != "" )
{
strRow += drow[j].ToString() + "','";
}
else
{
strRow +="-'"+",'";
}
k++;
}
}
}
Thanksss
|
|
|
|
|
hi,
i think instead of for each you can use for loop
and you have to pass the records number (ie; 1-10,11-20) based on the current index page of datagrid....
or else convert my previous code to C#.NET ,that is working fine for me ...
S Kumar
modified on Friday, March 13, 2009 5:12 AM
|
|
|
|
|
i have a web service(A) and web application (B) . B calls methods in A, for method A.X(Customer) i use the customer object which is created by XSD. after creating the Customer class by the XSD i added this file to both A and B. but when i call X() method from B it request an object of type A.Customer. it's not accepting an object type of Customer .what might be the problem.any idea.
|
|
|
|
|
Are the two the same? Try having them share the same class Customer. Hard to tell what is going on without some code...
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
i created the Customer class using the same XSD.this Customer class is added to both web app and web service.
as u suggested how can i share the same class
|
|
|
|
|
Add a new project to the solution and have them share that project.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
as u suggested if i create a new project and let it be shared by both , then both keep references, this cannot be allowed, what i want is, both should be able to this Customer object, what is the possible way.
|
|
|
|
|
The update on this problem is that now I have created a masterpage in a new project that contains the same layout as in my website project. In the test project the accordion works. When I move the page and the master page from the test project into my website project it does not work!!
When I do a view source on the page that works and the page that does not I see a difference in the the line
onsubmit="javascript:return WebForm_OnSubmit();"
from the line in the page that does not work:
the section for SAME PAGE and SAME MASTER PAGE - different projects????
Original post was as follows:
Accordion working on page but when put in contentpage of a masterpage it doesn't. What is the solution? I have tried everything and it is not apparent to me. This question has been asked many times in the internet, but no answers. Help please. A good suggestion would be appreciated.
This page is an accordion on a contentpage I believe.
Ok - I have created a new test project and I have the contentpage with the accordion and 4 panes and it works, but when I move the page to my website project it does not. The only difference is the masterpage. In my website I have login controls, themes, and a menu. The scriptmanager is in the masterpage even in my test project.
Getting closer - surely I am not the only person that has had this problem.
|
|
|
|
|
I have seen this happen when your DOCTYPE is different on the two different pages.
The best way to accelerate a Macintosh is at 9.8m/sec² - Marcus Dolengo
|
|
|
|
|
DOCTYPE is exactly the same. I have tried that but no difference. Good idea though. Thanks for the response.
|
|
|
|
|
See my update to this problem in the edited post
|
|
|
|
|
I found my answer - the following section was missing from my web.config file. I am not sure how it gets in there in the first place or why it was missing, but once added the accordion now works.
<httpmodules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">
Thanks for MY OWN help!!
|
|
|
|
|
I have a client that needs to upload files ranging from 30 - 100MB. These files needs to be uploaded via the internet. I have created a web application for them and they obviously get timeouts.
Is there any other way to upload a file via the Upload control in asp.net? I have been looking at possibly uploading via FTP but thus far my searches has been fruitless.
Can someone please point me in the right direction or link to a good use case?
Illegal Operation
|
|
|
|
|
You'd have to write an FTP application that was then installed in your page as an applet. Nothing else exists in ASP.NET because nothing else exists in HTML.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
I have used this [^] control to upload huge files with no problem. Darren has done marvelous job.
Yusuf
Oh didn't you notice, analogous to square roots, they recently introduced rectangular, circular, and diamond roots to determine the size of the corresponding shapes when given the area. Luc Pattyn[^]
|
|
|
|
|
Hi All,
My senario is: once a user clicks a button on web form, say Save, how can i disable this button to prevent user click it again.
Because this is a web form, so this one: btnSave.Enable = false wasn't working unitl the web fom refreshs, but i just want this button to be disable as soon as the user clicks it.
could someone in here guide me or point me to the right direction as i am struggling to get this work long time already.
Thanks heaps.
|
|
|
|
|
use javascript to disable the button.
www.anothercodesite.com/blog
|
|
|
|
|
Hi,
In the button click event you can write the btnsave.enable=false as a first line ,or else you can do it by using the javascript also ....
S Kumar
|
|
|
|
|
this is a web form, not a windows form, what you said in here wont work....
|
|
|
|
|
Hi,
Are you using UpdatePanel?
Thanks,
Rajdev KR
|
|
|
|
|
|
I have done pretty much the same thing. I ended up using a little jscript. I call it with the "true" or "false" that I want the item to have.
function applyvalidate(myenableflag) {
document.all.validate.disabled = true;
if (myenableflag == true) {
document.all.validate.disabled = false;
}
if (myenableflag == false) {
document.all.validate.enabled = false;
}
}
The name of the button is "validate". I do this so that the person has to have a valid form (actively check with jscript) and when it is valid, the validate button lights up. they can then hit the validate button that provides a code for entry into a checklist. Then I light up the submit button.
At anytime when the formcheck becomes invalid, i use the same functions to disable the buttons on the fly.
Does that help?
|
|
|
|
|
ya it does help. thanks a lot.
|
|
|
|
|
Glad it helped. I can't even remember how and where I stumbled across that... allowed me to do a TON of client side automation on forms. Probably NOT the best solution, but in specific areas, it works well...
|
|
|
|