.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

Can I fill a linqdatasource with a file list?

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net

If this is posted twice, I'm sorry.  I thought I posted it once, but I didn't  see it come through. 

I have a working page that was rather painstaking  for me to build.  We have people who each has one or more images.  We use a table that has a personId field and a filename field.  The page has a Listview control that uses a LinqDataSource.  The listview displays all the images - one at a time - for a particular person, but I have it so that the first image displayed is either a specific image for the person if one was requested by the user, or a random image for that person.  So the user can scroll through all the images for a particular person, but the first image displayed is either a requested image or a random image.  As I said, this works.

I have another page that I want to do the exact same thing on, only in this case I don't have the images in a database table. The images are named so that once I have the personId, I can find all that person's images.  So


Dim tstQuery = From tstArt In db.memArtworks _
                       Where tstArt.file2 = sFile _

View Complete Post

More Related Resource Links

List common file types in a .NET project.

List common file types in a .NET project.

Powershell script to copy a list attachment to a file

I have a script that builds a list of items.  I'd like to add the ability to download the list items' attachments to a local directory.  IS this possible?  There are lots of examples of how to add attachments but nothing that can download the attachments.  Any help would be appreciated.

customize list view table header css file

i need to make table header for my list to be red and on hover to get specific  image so all my site have the same appearence also i need this to reflect to the list view webpart thanks

MDAC SDK - why is the list of OLE DB providers different to what I see when creating a UDL file?

In MDAC 2.8 SDK on Windows Server 2003 SE x64.  Using RowsetViewer 2.70, list of datasources is not same as when I edit a UDL file on the same server.  Why is this? I want to test a specific OLE DB provider, but it's not on the list within the SDK's tools.  I can see the specific provider in the registry, and it has the correct format as defined in the SDK's OLE DB documentation for providers, so It's installed correctly.  Note, the provider works okay with the application and tests okay in the UDL file edit dialog.  It's just the SDK that I can't use it in :-( Alternately, is there another (3rd party?) tool I could use?  All I'm looking to to do is run simple SQL query test via OLE DB to get timings.  Note, I'm a programmer, but not used to ADO or OLE DB interfaces - that's why I'm looking for a ready made tool :-) Any help would be be great, thanks, Richard.  

SharePoint 2010 Export list Items to Excel, wrong url in iqy file

Hi, I have a SharePoint 2010 Environment that uses https://portal.<something>.com. Exporting to Excel of a list uses wrong URL. When I go to the a list, select the list to show the "office ribbon" and then select export to excel, excel will show the error "Excel cannot connect to the SharePoint List". When I take a look at the IQY file that is created it contains the wrong url: http://portal.<something>.com instead of https://portal.<something>.com Changing the URL in the IQY file manualy to https://portal.<something>.com and then opening it will excel is working fine, list data is exported to excel then. Alternate access mapping is configured to use https://portal.<something>.com as default, export to access is working normaly. I already deleted the http://portal.<something>.com alternate access mapping once to see if this fixes the problem. No fix, even not after IISreset or rebooting the server. Where or how is the export to Excel IQY file created and where is it possible to fix the URL it is putting in the IQY file? Grtz, Arjan

Attach File to Custom List

Hello - I need to use the Client Object Model to attach an item to a custom list item.  I have attachments enabled on the custom list.  The following code will upload a attachment to a list item ONLY if at least one attachment was added to the item via SharePoint. Dim credentials As New System.Net.NetworkCredential(MyUser, MyPassword, MyDomain) Dim SiteUrl As String = "http://spsandbox13" Dim clientContext As New ClientContext(SiteUrl) clientContext.Credentials = credentials '-- List item 41 hard coded for testing Dim attachmentPath As String = String.Format("/{0}/Lists/{1}/Attachments/{2}/{3}", "sites/ITS/GBPlayground", "FormConfiguration", "41", "SomeFileNameForMe7") Using fs As New FileStream("C:\Users\gbadmin\Documents\WhatsUp.txt", FileMode.Open) Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, attachmentPath, fs, True) End Using The above code works great as long as the item already has an attachment.  If the item doesn't have an attachment I get a (409): Conflict error.  I've also tried to create a folder in the attachments folder for the list item to see if once the folder was created that the error would go away.  The code for this is as follows: Dim list As Microsoft.SharePoint.Client.List = clientContext.Web.Lists.GetByTitle("

File upload error -List View threshold setting


When I was trying to upload multiple images it was showing the following error.

"Failed to upload file 'filename'Try uploadiing again"

So when I looked into the Picture library setting it was showing


List view threshold :

5050 items (list view threshold is 5000).
The number of items in this list exceeds the list view threshold, which is 5000 items. Tasks that cause excessive server load (such as those involving all list items) are currently prohibited.

Learn about managing a large list or library and ensuring that items display quickly.


Whether it is the error with the threshold limit.If so whther I can change the limit and is it safe?



Need help running sql as batch file that creates a list of borrowers


Our application database was recently upgraded from mssql server 2000 to 2008.  I am unable to get a batch file that creates a list of updated
borrowers to run.  It was running fine on Windows server 2000 (even after the upgrade to mssql 2008), but I
recently wiped that old server and installed windows server 2003.  The
drive that the file lives on changed, so I changed the name in the
file, but it will not run.  When I try to run it from a command prompt
I get the error:

'melcat_daily_borr_export.bat' is not recognized as an internal or
external command, operable program or batch file.

The text of the file is :
isql -S192.168.36.2 -Pmypassword -Umyusername
-iD:\Horizon\melcat\melcat_daily_borr_export.txt -b -h-1 -n -w800 -O

I have tried running the command with the name in quotes, I have
changed the file to a .cmd rather than a .bat, all to no avail.  The
sql that the file calls will run and return results.  Yes I am using
my proper user name and password.

The text of the sql called is this:

use horizon

set nocount on



Create Excel file dynamically in SSIS package and fill it by resultset data returned by Stored proce


Hello Every One,

I have a scenario in which i am executing a Stored Procedure which returned a result set.

I want to create a Excel file [name_date_time] dynamically, and fill result set data into Excel file. And then finally sent Excel file to Specific user[Email ID].

Point is that the excel file should have unique name so i want to give name as name_date_time.

So every time when package run new file is created with unique name.


Can any one suggest me who to create Excel file and fill result set data into Excel file.

And then finally send that Excel file ?







need help on programmatically adding .pdf file type to File Type list in Search Admin


This is easily done in the GUI but how do I program this?

I looked here - http://msdn.microsoft.com/en-us/library/ms562090(v=office.12).aspx and they just say - Extensions are grouped within an ExtensionCollection object. Use the Create method to specify a new file name extension.

Great but how do I do that - I'm not a coder and I need some pointers

I loaded the sharepoint assemblies:

[System.Reflection.Assembly]::Load("Microsoft.Office.Server.Search, Version=, Culture=neutral,

[System.Reflection.Assembly]::Load("Microsoft.Sharepoint, Version=, Culture=neutral,

[System.Reflection.Assembly]::Load("Microsoft.Office.Server, Version=, Culture=neutral,

Where do I go from here?




How can I get a list of applications registered for a certain file extension in a WPF application?

I'm looking for a Win32 or Shell function that can be called from a WPF application to get a list of registered applications in Windows for a specific file extension. For instance if I would pass ".rtf" to the function it should return something like "Microsoft Office Word|C:\Program Files\Office\Winword.exe|Wordpad, C:\Program Files\Windows NT\Accessories\wordpad.exe". I need this to construct a 'Open with' context menu somewhat related to the file context menu in Windows Explorer. In Windows Forms I could get the the Windows Explorer context menu with IContextMenu, IShellFolder etc. But this approach requires a WndProc because the context menu data will be send with WM_ messages. But for WPF this is not an acceptable solution because there is no WndProc. I know that I can get that data from the registry HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\FileExts\.png\OpenWithList but I will not use it because in a future Windows release the registry structure may change and this would break my application. I also don't want to mess around in Windows internal data. And there is no list to get anyway. All I found in the registries .png\OpenWithList key was a DllHost.exe and mspaint.exe. But DllHost.exe is no application to open a .png file. And the mspaint.exe doesn't specify a path. The display names are also missing.

SharePoint Custom List Attachment to Store URL and Not a File


I need to ust the attachment column for a list, but I want to store the URL NOT the attached file.  I could use a Link Column type, but doesn't have the browse utility that the attachement column has. 

Any ideas?  I would like to store the URL and not the FILE with the browse utility

WCF NetDispatcherFaultException - Throws exception only when I include file (List)


Hi All,

My service would return a file (List<byte> - use WSSF so dont know why it is a list rather than a byte array. When I consume the service it throws the following exception:

"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://www.tempuri.org. The InnerException message was 'Error in line 1 position 1124. Expecting state 'Element'.. Encountered 'Text'  with name '', namespace ''. '.  Please see InnerException for more details."

Any ideas on how to fix it would be much appreciated.



File upload in asp.net data list control

iam not able to get the file upload control posted file name in the asp.net datalist control. Can any one please give me the solution.

SQL file will not open in SSMS on double-click (or jump list)


Hello, all.

I am running SQL Server Management Studio 2008 on a Windows 7 Enterprise machine here at work.  I am not sure when this started happening, but now, for some reason, when I double-click on a SQL file in Explorer, or from the jump list for SSMS (which I have pinned to my Windows 7 task bar), SSMS will open, but will not load the file in question, nor will it bring up a logon screen to connect to a DB.  I tried unassociating the .SQL extension and then re-associating it using "Open With" and it worked the first time (from the Open With), but then immediately reverted back to its old behavior.  Very annoying.

For now I just open SSMS first (which pops up a logon screen and things proceed normally), but that kind of defeats the purpose of having a jump list or a file association.  Has anybody run into this before and can anybody suggest a fix or what's wrong?

Thanks in advance for any wisdom anyone can provide. 

Import list from excel file



I try import a table from excel file to become a SharePoint list.

I want the first column in the excel to become the title column (linked to item).

I did some tests and in each tests it tooks a different column of the excel to be the sharepoint column which is "linked to item with edit menu".

What is the logic and how may i control which excel column will be that sharepoint column?


ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend