.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

Hi this method is working fine need filter how

Posted By:      Posted Date: August 25, 2010    Points: 0   Category :ASP.Net

private void GetData()
        for (int i = 0; i < Gridview1.Rows.Count; i++)
            DataView dv = (DataView)SqlDataSource1.Select(DataSourceSelectArguments.Empty);
            DataRowView drv = dv[i];

View Complete Post

More Related Resource Links

In sharepoint excel working fine in office 2007 but not in office 2010


Hi All,

we receive error  while trying to create excel sheet using the template we have uploaded on the SharePoint 2007.


This occurs on a machine that has Office 2010 installed. Earlier the machine had Office 2007 and everything was working fine.


Can you let me know why is problem is coming and how to resolve this.



Sanjeev Tiwari


Web Part working fine on the top-level page but 'Not Safe' error on lower-level pages.


I have created a Web Part which reads and parses the SharePoint logs in order to display usage information of the page it resides on.  The Web Part works perfectly on the top page, reading and displaying the information desired.  However, once the Web Part is added to any page lower in the site heirarchy (sub-page) the same Web Part throws the following error:

Web Part Error: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.

Show Error Details
Hide Error Details

[UnsafeControlException: A Web Part or Web Form Control on this Page cannot be displayed or imported. The type could not be found or it is not registered as safe.]
  at Microsoft.SharePoint.ApplicationRuntime.SafeControls.GetTypeFromGuid(Guid guid)
  at Microsoft.SharePoint.WebPartPages.SPWebPartManager.CreateWebPartsFromRowSetData(Boolean onlyInitializeClosedWebParts)

Of course the current version of the Web Part is in the SafeControls list on the web.config.

The Web Part was originally designed to return site activity only for the top default.aspx page and worked fine but started to fail in the manner described above once I added the following line of code to return a SPCo

wpf datagridview checkbox column selection not working fine.

Hi Experts,in my c#.net windows based wpf application i added  a datagridview.dynamically i added checkboxcolumn to that datagridview DataGridViewCheckBoxColumn cbCol = new DataGridViewCheckBoxColumn(); GridSource.Columns.Add(cbCol); and another column is string. to this column am hardcoding the values DataTable _datatable = new DataTable(); _datatable.Columns.Add("Name", typeof(string)); _datatable.Rows.Add("CSRs"); _datatable.Rows.Add("Customers"); GridSource.DataSource = _datatable; till here fine am getting two columns (checkbox and Name)when i am trying to check those checkboxes problem comming.am trying to get the count of the checked rows for that i used below code int cbcount = 0; foreach (DataGridViewRow _dgRow in GridSource.Rows) { if ((bool)_dgRow.Cells[0].Value) cbcount++; } cbcount will give the checked count.but the problem raising here if i check 2 rows it giving 1if i check 5 rows it giving 4if i check 1 row it giving me 0means am getting n-1 resultwhere i did wrong??

Missing DataContext! Was working fine, now it's hosed

So I have a web application, set up for .NET 4.0 ... I had a robust LINQ TO SQL Classes object, and it was running just fine. But I needed to make a schema change so I altered my database. No problem. Then I went into my .dbml file and deleted the table I had been working on. Then I re-added the table by dragging it from the server explorer. However, now my code is throwing a number of errors, all saying they can't find my DataContext, called ModelDataContext. I hadn't changed any other app code, so I am really confused!Error 3 The type or namespace name 'ModelDataContext' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Ed\Projects\NBAdminPanel\NBAdminPanel\WebApplication1\DynamicData\CustomPages\Accounts\Edit.aspx.cs 49 29 NBAdminPanel The type or namespace name 'ModelDataContext' could not be found (are you missing a using directive or an assembly reference?) C:\Users\Ed\Projects\NBAdminPanel\NBAdminPanel\WebApplication1\DynamicData\CustomPages\Accounts\Edit.aspx.cs 49 29 NBAdminPanelSo basically my app no longer knows about the class generated from this DBML file. I have tried recreating it by deleting the old one and readding objects to the new one, no dice. I am at my wits end; hoping I don't have to junk the project and start a new one! My DBML file is still in MyProject.App_Code. 

Out-of-box filter stops working as soon as I "Configure Datasource"

I'm running VWD 2008 Express with ASP.NET 3.5 I realize now that 4 has much better filtering controls, but I didn't realize that when I started my project.  Anyway, when I use the standard List.aspx to display a table, the filtering works just fine (yes, it's only foreign keys and booleans, but it works).  I then modify the linq datasource so that the gridview only displays the columns that I want, and the filter function immediately stops working.  You can choose from the drop down lists, but nothing happens.  As an aside, I don't want to set scaffolding to false for those columns because I do want them to show up in the Edit.aspx page.  My understanding is that scaffolding settings would keep the field from showing up in either page. What do I need to include in either the gridview or the linqdatasource to get the filter working again?   Thanks!

MS Filter pack for Zip files content search not working

I am facing a problem related to Zip files content search. Searching of content inside zip files doesn't return in search results. But searching for zip file name returns filename in search results. I look into Crawler log, all it says is:   Steps I followed to install MS Filter pack: Installed MS Filter Pack 1.0 (x64) http://support.microsoft.com/kb/946336/en-gb In Search Administration page added "zip" in File types Add Reg subkey under : "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Office Server\12.0\Search\Setup\ContentIndexCommon\Filters\Extension\" for ".zip" with value ={20E823C2-62F3-4638-96BD-90F4F6784EBC} Stop and Start oSearch Run full crawl of content sources Can you please advise or have any tips you got to resolve this. Thanks http://portal/testzip.zip Crawled (The filtering process could not load the item. This is possibly caused by an unrecognized item format or item corruption. )

Should a call back method always be used when working with smtp?

I read about a call back method that was used with some code for an smtp client.  Should callback methods always be used to verify delivery and get status codes when working with smtp relays and clients? 

asp menu working fine in the dev environment but not on server

Hi guys,        I am sorry to be asking what is probably a really stupid question, but i have a problem with my asp menu, when i run it on my dev machine(thru vs2010) it works perfectly, all the menu's are displayed correctly with the correct child items in the correct order but when i publish it to the server all the menu items become flat and take up the whole page. I am populating the menu using a reentrant function as follows to call the function and add the menus i am using Dim childMenuItems As List(Of MenuItem) = CreateMenuLevel(0, uniquemenulist)childMenuItems.ForEach(Sub(n) NavigationMenu.Items.Add(n)) Public Function CreateMenuLevel(ByVal parentId As Integer, ByVal menulist As List(Of MenuList)) As List(Of MenuItem)        Dim menuItems As New List(Of MenuItem)        For Each menuListItem As MenuList In menulist.Where(Function(n) n.ParentId = parentId)            Dim MenuItem As New MenuItem            If (Not String.IsNullOrEmpty(menuListItem.PagePath)) Then                MenuItem.NavigateUrl = menuListItem.PagePath           

i have tested the same coding with dropDownlist but its working fine..I don't know why its not work

Dear Members,              I have used the following to bind the data from database into Ajax comboBox...but it's not working...             Actually i have tested the same coding with dropDownlist but its working fine..I don't know why its not working with Ajax ComboBox..          DropDownList Coding  private void LoadDropDownCatetory() { string connectionString = ConfigurationManager.AppSettings.Get("mcrmdb"); dropDownListTest.DataSource = ProductDataAccess.FillProductCategory(connectionString); dropDownListTest.DataTextField = "CATEGORY"; dropDownListTest.DataValueField = "CATEGORY"; dropDownListTest.DataBind(); } AjaxComboBox Codingprivate void LoadProdutCategory() { string connectionString = ConfigurationManager.AppSettings.Get("mcrmdb"); comboBoxProductCategory.DataSource = ProductDataAccess.FillProductCategory(connectionString); comboBoxProductCategory.DataTextField = "CATEGORY"; comboBoxProductCategory.DataValueField = "CATEGORY"; comboBoxProductCategory.DataBind(); } Design

get() method of Jquery not properly working in IE



 I used get method for getting JSON data from .aspx page.This JSON data for chart application which show monthly records.For selecting month I used dropdown and defaultly I set current month chart.But for showing previouse month records in chart   i want to select the  previouse month but chart not shows selected Month record rather than it shows default record.

Full text search not working for pre-existing data on table after installing docx filter.However wor


Hello All,


I have a strange issue. I have pre-existing data in my table with full text index defined along with catalog. I noticed that I did not have the docx filter ,so I installed the filter and performed the steps below. After installing the filter  I added a couple of new records. I noticed that the full text search pulled up the new records matching the criteria but did not return any pre-existing records. Could you please let me know the issue.Please note – currently I am using sql 2008 , but also would like to verify the same in sql 2005 as well.

Also could you please verify the steps below for installation in sql 2008 and sql 2005 and with different architectures (Eg windows 2003/2008, 32bit, 64 bit etc)


This was tested on VM image on 64 bit architecture Windows 200

Filter on web part not working for certain columns


Hi all,

I have a list of "Faults" - this contains the Shop Number that the fault was logged against (which is a lookup column to the "Shops" list), who logged the fault ("Created By") and the details of the fault ("Title").

If I add the list as a web part and filter by Created By, it works perfectly - I get multiple entries in the list for all faults logged by a certain person.

However, if I filter by a Shop Number - I only get a handful of entries in the list, going back a few days - anything older than that is simply not there.

Yet if I go to the main page for the Faults List (AllItems.aspx) and change to Datasheet view - the filter works perfectly, I can see EVERY entry for a particular Shop when filtering on Shop Number.

Any ideas? It only seems to happen when using a Web part OR a DFWP - as a result, I can't pass the Shop Number as a filter parameter to it, nor can the users see a complete history of faults when viewing individual shops.

I've no idea what has changed recently, other than deletng some custom views we had created in the Faults list - could this have caused a problem? Can the Faults list be "reset" somehow without losing any data? To clarify - it's ONLY happenning when the list is viewed as a web part of DFWP, when it's viewed in Datasheet m

Filter expression not working


Hi, I am using a GridView and I require the user to be able to filter using 2 controls. One simply filters the type of row - there is a column called action, and the user selects one of the distinct values from the database in a dropdown box, and the gridview only displays the rows with that value in the action column. On it's own this works perfect.

But I am also adding a textbox where the user can type in an ID of either the 'itemID', or the 'parentID'. This works fine even with the previous control.

Problem is, the dropdown box does not work when the textbox is empty (i.e. all ID's are being shown). If I choose a value and click Submit, it just doesn't do anything. Now if I am filtering by ID and then choose a value from the dropdown box, it works perfect.

Here is my filter expression and parameters of the datasource:


 <asp:SqlDataSource ID="SqlDataSource1" runat="server"  
        ConnectionString="cleared for privacy" 
        SelectCommand="SELECT * FROM [Audit] WHERE ([source] = @source)" FilterExpression="action like '{0}%' and (itemID like '{1}' or parentID like '{1}')"> 
            <asp:Parameter DefaultValue="LOGISTICS" Name="source&quo

SSRS working fine in Report builder and manager but not in Report viewer


HI I have a report that worked fine until we upgraded the SQL server from 2008 to 2008 R2 and the report viewer to latest version as well.
This report has a pie display, NOW instead of showing one pie, it is showing 20 pies!

I am trrying to learn how to resolve and what is causing this. 

Need help setting up a Custom Security Trimmer, CheckAccess method not working.


I'm implementing the custom security trimmer for SharePoint server as outlined here: http://msdn.microsoft.com/en-us/library/ee819923.aspx

I have been able to successfully deploy the solution on to the server, but know I need to write the script that will check whether users have access to particular documents or not. The code in the walk-through is the following:

public BitArray CheckAccess(IList<String> documentCrawlUrls, IDictionary<String, Object> sessionProperties, IIdentity passedUserIdentity)
            BitArray retArray = new BitArray(documentCrawlUrls.Count);
            //Use passedUserIdentity to get the identity of the user who issued the query.
            IClaimsIdentity claimsIdentity = (IClaimsIdentity)passedUserIdentity;
           //IClaimsIdentity is defined in Microsoft.IdentityModel.Claims;
            for (int x = 0; x < documentCrawlUrls.Count; x++)

mdx - filter "not working" when i use equals zero


I'm filtering customers, depending on some other dimension and measure. If I use > , <, = with any number different than 0, it works fine. < and > works even with 0, but = "doesn't work"

this is my query>



dynamic set Segment0 as





Unable to connect to sql server in network but working fine over VPN




I have a sql server 2005 named instance running on windows 2003. I have an issue  in sql connectivity:

When the client system is in the network, client is not able to connect in management studio to the SQL server without specifiying the port number i.e. tcp: abc\xyz. If the client specifies the port number, he is able to connect to it like tcp:abc\xyz,20001.

Now the strange thing is : The same client system when connected over vpn works fine without specifying the port number in the connection string  like tcp: abc\xyz,20001.

then why is it failing to get the port number when the system is in the network?

I verified sql browser service. it is running fine. Firewall is in stopped state. What new components would come into picture over vpn that allow browser to service the port number? It's pretty strange issue and hence looking for any thoughts.

Note: SPN is not registered for the sql service.


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