|
hey manas...
How about
datataable.AsEnumerable().Take(n) //where n is the no of rows from datatable.
|
|
|
|
|
Abhishek Sur wrote: datataable.AsEnumerable().Take(n)
This is so nice.
I am still living with VS 2005. I must plan to move on to the VS 2010 soon
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
I guess so mate. Few days back... I was in 2005 like you.
But after using LINQ.. I always suggest to shift from 2005, and work in 2008. 2010 is far apart. Even I didnt have a chance to work on it..
Cheers.
|
|
|
|
|
Abhishek Sur wrote: 2010 is far apart
Not that far. Already started the download[^]
Manas Bhardwaj
Please remember to rate helpful or unhelpful answers, it lets us and people reading the forums know if our answers are any good.
|
|
|
|
|
Yes Thank you for the link... Already tried the Parallel Extensions in .NET 3.5 .. Excited to see .NET 4.0 with truely multicore support in it.
I have already downloaded the 2010 Beta.. Just have to start doing some tests in this 1.
Hope you are also enjoying this big release too.
|
|
|
|
|
I had a setup where I had a datalist of course listings, and when the items were created I went out to a remote sql server and retrieved the faculty for each course. But, that seems to take too long to load, so I thought it would be faster to go get all the data at once on page load and then filter with data views. But, I can't seem to get there. I tested on a datagrid outside the datalist and it populates with 3 rows fine. (Number one - is my assumption correct? Number two - what am I doing wrong? Is the Public Data.dataView not available when I'm trying to call it?)
It stops on the line
'dv.RowFilter = "eid=" & myEID.ToString
with the error: Object reference not set to an instance of an object.
If I comment out the line, I get no datagrids.
Imports dsList
Partial Class orpce_hcClasses
Inherits System.Web.UI.Page
Public ds As New Data.DataSet
Public myFacView As Data.DataView
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Dim myList As dsSql = New dsSql() ''''instantiate the function to get dataset
Dim myView As Data.DataView
Dim myStr As String = ""
ds = myList.dsListAll(go get the initial course datalist dataset)
If ds.Tables("list").Rows.Count > 0 Then
myView = ds.Tables("list").DefaultView
dlList.DataSource = myView
myView.Sort = "startSort"
dlList.DataBind()
If ds.Tables("list").Rows.Count > 0 Then
Dim i As Integer
For i = 0 To ds.Tables("list").Rows.Count - 1
myStr &= ds.Tables("list").Rows(i)("eid").ToString & ","
Next
myStr = Left(myStr, Len(myStr) - 1)
End If
ds = myList.dsListFac(myStr)
myFacView = New Data.DataView
myFacView = ds.Tables("faculty").DefaultView
End If
End If
End Sub
Protected Sub dlList_ItemDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.DataListItemEventArgs) Handles dlList.ItemDataBound
Dim myEID As String = Convert.ToInt32(CType(e.Item.FindControl("txtEID"), TextBox).Text)
Dim dv As Data.DataView
Dim dg As DataGrid = CType(e.Item.FindControl("dgFac"), DataGrid)
dv = myFacView
'dv.RowFilter = "eid=" & myEID.ToString
dg.DataSource = dv
dg.DataBind()
End Sub
|
|
|
|
|
hello there, I have one question. I am rewriting whole web application, and some pages of the old one are in html format. I want to know if the session will be maintained once the user open the html file, and is it still possible to add items from the html file to the shopping cart, which is build in asp.net. Thanks for your help
|
|
|
|
|
Yes, the session exists on the server. I don't know if requesting a html page would reset the timeout, but I'd suspect it would. Either way, going between them will not erase the session automatically, even if it does cause issues with a timeout. Your best bet is to test it. Set something up in the session. Refresh a html page every minute or so for 10 or 15 minutes, whatever the timeout is, plus a bit. Then go to a page that shows the session value.
Christian Graus
Driven to the arms of OSX by Vista.
Read my blog to find out how I've worked around bugs in Microsoft tools and frameworks.
|
|
|
|
|
Hi Dears
I traveled from VS2005 To VS2008 team system.
It's so good, but i got a problem!
In VS2005, we can change the "Default Css Positioning" and set it to Absolute, but in VS2008 i can't find this option.
Please Help me.
Thank you for your help in anticipation.
|
|
|
|
|
|
Hi,
I am making a web application which uses webservices. The problem is that whenever I reopen my web application after closing it, I get an error message:
http://lh3.ggpht.com/_EC8qUhn9kJY/SrOHGWPKa0I/AAAAAAAAAHE/vByKCtukRsk/error%28web_service%29.JPG[^]
Then I have to delete and add webservices again to make the project back in working state.
This same problem also occurs when I leave my project in idle state for long time.
How can I resolve this error?
Any help shall be appreciated.
|
|
|
|
|
Can you specify the actual error message that comes. I cant see the image, I think there must be some problem with the link.
|
|
|
|
|
the error is as follows
Failed to update WEB REFERENCE 'MAILSERVICE_assign_req.SENDMAILService3'
ERROR: there was an error downloading 'http://localhost:1446/sendmailservice/sendmailservice3.asmx?disco'.(0x80131509)
|
|
|
|
|
Can you tell me what you are referencing while adding the web service. Are you adding sendmailservice3.asmx?wsdl
If so try to connect to sendmainservice3.asmx?disco
Have you tried to browse the disco file directly?
You can also add reference to web service manually.
open Visual studio command prompt,
browse to your application directory
type
disco http://localhost:1446/sendmailservice/sendmailservice3.asmx
this will generate a wsdl file, disco, and discomap file on your disk
Next type
wsdl sendmailservice3.asmx
This will generate the c# file
Now include those files to your project and try to run.
|
|
|
|
|
Hi Abhishek,
I tried adding the things YOU specified but nothing seems to happen all the files were added , but the error still comes.
here is the code along with responses You asked me to Run in visual studio cmd:
Setting environment for using Microsoft Visual Studio 2008 x86 tools.
C:\Program Files\Microsoft Visual Studio 9.0\VC>cd\
C:\>cd C:\Documents and Settings\server\My Documents\Visual Studio 2008\WebSites
\my_project
C:\Documents and Settings\server\My Documents\Visual Studio 2008\WebSites\ my_project >disco http://localhost:1446/SendMailService/SendMailService.asmx
Microsoft (R) Web Services Discovery Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.1432]
Copyright (C) Microsoft Corporation. All rights reserved.
Disco found documents at the following URLs:
http://localhost:1446/SendMailService/SendMailService.asmx?disco
http://localhost:1446/SendMailService/SendMailService.asmx?wsdl
The following files hold the content found at the corresponding URLs:
.\SendMailService.disco <- http://localhost:1446/SendMailService/SendMailServi
ce.asmx?disco
.\SendMailService.wsdl <- http://localhost:1446/SendMailService/SendMailServic
e.asmx?wsdl
The file .\results.discomap holds links to each of these files.
If you would like more help, please type "wsdl /?".
C:\Documents and Settings\server\My Documents\Visual Studio 2008\WebSites\ my_project >wsdl http://localhost:1446/sendmailservice/sendmailservice3.asmx
Microsoft (R) Web Services Description Language Utility
[Microsoft (R) .NET Framework, Version 2.0.50727.1432]
Copyright (C) Microsoft Corporation. All rights reserved.
Writing file 'C:\Documents and Settings\server\My Documents\Visual Studio 2008\W
ebSites\my_project\Service3.cs'.
please reply
|
|
|
|
|
Hi all,
I've been having trouble trying to figure out a way to loop through controls in a User Control to find LoginViews and when found manipulate each of them.
With the following code snippet the LoginView controls are found but cannot be manipulated.
Code:
For Each lv as Control In Me.Controls
If lv.GetType().ToString().Equals("System.Web.UI.WebControls.LoginView") Then
CType(lv, System.Web.UI.WebControls.LoginView).RoleGroups(0).Roles = "role"
End If
Next
Thanks in advance.
|
|
|
|
|
Hi,
I have 3 different Datatable with different coloumns, i want to concatinate with 3 tables into a single table , but i dont want to merge how can achieve this,
datatable1
datatable2
datatable3
1st table 5 columns
2nd table 7 columns
3rd table 3 coloumn
for (i=0 to 3)
{
for(j=0 to datatable1.columns.count-1)
{
dr1[j]=j;
}
for(j=0 to datatable2.columns.count-1)
{
dr2[j]=j;
}
for(j=0 to datatable3.columns.count-1)
{
dr3[j]=j;
}
}
So finally i want to concatinate with the 3 table with 3 rows...
note:
I dont want to merge.. How to do this...
Plz answer me...
thanks in Advance..
kannak......
kannak
|
|
|
|
|
Use this :
DataTable dt = datatable1.clone();
foreach(DataColumn dc in datatable2.Columns)
{
DataColumn dc1 = new DataColumn(dc.Caption,dc.DataType);
dt.Columns.add(dc1);
}
foreach(DataColumn dc in datatable3.Columns)
{
DataColumn dc1 = new DataColumn(dc.Caption,dc.DataType);
dt.Columns.add(dc1);
}
Now to merge the data you need to
for(i=0;i<datatable1.rows.count;i++)
{
DataRow drNew = dt.NewRow();
for(j=0;i<dt.columns.count;j++)
{
if(j< datatable1.Columns.count)
drNew[j] = datatable1.rows[i][j];
else if(j<(datatable1.Columns.count + datatable2.Columns.count))
drNew[j] = datatable2.rows[i][j-datatable1.columns.count-1];
...
}
Finally
dt.Rows.Add(drNew)
You can also make it more cleaner. Also change it according to your need.
Hope it works
|
|
|
|
|
Hi,
In asp.net 3.5, how is it possible to
1)Export the data of a datatable into .csv file
2)Save the spreadsheet on the network as c:\temp\
Thanks
|
|
|
|
|
Check the previous thread.Is that you actually looking for?
Else Google.
|
|
|
|
|
|
why use CSV .. Create Original Excel file rather.
Check this :
http://www.codeproject.com/script/Forums/KB/miscctrl/Excel_data_access.aspx
Hope this will help you.
|
|
|
|
|
Hello all,
In my ASP.Net application, i am transferring GridView contents to a excel file. I am using following code:
string attachment = "attachment; filename=MakeList.xls";
Response.ClearContent();
Response.AddHeader("content-disposition", attachment);
Response.ContentType = "application/ms-excel";
StringWriter sw = new StringWriter();
HtmlTextWriter htw = new HtmlTextWriter(sw);
GridView1.RenderControl(htw);
Response.Write(sw.ToString());
Response.End();
It was working fine, but as soon as i put this code in try-catch block, i am getting this error:
"Unable to evaluate expression because the code is optimized or a native frame is on top of the call stack."
If i remove try-catch block, it again works fine.
Can anyone tell me whats the problem? Am i miising something?
Thanks,
Nagendra.
|
|
|
|
|
|
I tried the solution. Now i am not getting any exception but now instead of GridView contents, the whole WebPage is copied in excel file.
I want only GridView contents in excel file.
|
|
|
|