.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

gridview is not returning results..

Posted By:      Posted Date: September 02, 2010    Points: 0   Category :ASP.Net
Gridview is not being populated now that i built my objectdatasource in the code behind.. why. If i build the source on the aspx page and configure it that way, it returns results.. but when i try to build it in the code behind it just displays my empty template for the gridview.01.protected void btSearchDVR_Click(object sender, EventArgs e) 02.{ 03. if (ddlDVR.SelectedValue == "0") 04. { 05. rfvDVR.IsValid = false; 06. } 07. else 08. { 09. ObjectDataSource ObjectDataSource1 = new ObjectDataSource("DataAccessCode", "SelectDVRInfo"); 10. ObjectDataSource1.SelectParameters.Add("@dvrName", TypeCode.String, ddlDVR.SelectedValue.ToString()); 11. ObjectDataSource1.DataBind(); 12. 13. GridView1.DataSource = ObjectDataSource1.ID; 14. GridView1.Visible = true; 15. GridView1.DataBind(); 16. } 17.}  

View Complete Post

More Related Resource Links

SPDataSource returning 0 results when used in CrossList Mode



I'm writing a web part in C# to query several document libraries, using a SPDataSource with the results going to a SPGridView.

I got the query to work just fine with a single document library, but when I switched the SPDataSource to CrossList mode (and added the "Web" and "Lists" tags to the query), I end up with no results. I've done a lot of digging around on the web for examples of how to do this correctly, but always end up with the same result, no hits.

These are the only properties I'm setting on the data source:


ds.DataSourceMode = SPDataSourceMode.CrossList;

ds.UseInternalName = true;

ds.SelectCommand = queryString;

The query string looks like this (I added the formatting for readability... the actual query string is all a single line):

<Webs Scope='SiteCollection'></Webs

Search query returning 0 results

I'm using a query which returns 0 results but was working some weeks ago.  I checked the code and nothing has changed since then.  I created a Search Center Site on another port and using the same terms I get many results there.  I checked my scopes and they are all right. Nothing changed there either. Could someone help me figure out what may be the problem in my query.  Or maybe it's my Scopes/Content Sources configuration. SELECT URL, FileName, Title, Description, Rank, Size, HitHighlightedSummary, Path FROM SCOPE() WHERE freetext(defaultproperties, ' +légumes')  AND ( "scope" = 'Scope - My Portal - All Site - fr'  )    ORDER BY Rank DESCDaniel Siconnelli There is neither good nor evil... only mogwais and gremlins

SharePoint Server 2010 Search - not returning results but crawling without errors

I have created a Search Service Application on a SharePoint Server 2010 (RTM) Farm and used the default Content Source. I started a Full Crawl and it suceeded with no errors etc. I ran it a few times and no issues. But if I go to the Intranet Portal Web Appliaction and do a search for a document that would have been crawled it does not show up in search results...nothing does. I am not getting any errors in Event Log or ULS Logs relevant to Search. How can I troubleshoot this problem further?SharePoint Solution Architect, Perth Australia - Microsoft Virtual Technology Specialist - MCTS WSS Dev, WSS Adm, MOSS Dev, MOSS Adm - http://wss.made4the.net/ - Founder of http://www.sharepointdevwiki.com/

Gridview RowCommand Event returning null values

HiI'm trying to retreive values entered by users in the textboxes in the footer of the gridview and insert these values into another sql table.My code is as follows :-protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)    {       if(e.CommandName.Equals("addnew"))       {                       TextBox t1 = (TextBox)GridView2.FooterRow.FindControl("tfrm");            string frm = t1.Text;            TextBox t2 = (TextBox)GridView2.FooterRow.FindControl("tsub");            string sub = t2.Text;            string cmd = "insert into suggestions values('" + frm + "','" + sub + "','c','c')";            con.Open();            SqlCommand com = new SqlCommand(cmd,con);            int a = com.ExecuteNonQuery();&n

Showing Solr XML results in gridview using xmldatasource

I have the XML below, generated by Apache Solr.I want to assign the results (2 <doc>nodes in this case) to a gridview using an XML datasource.<response>-<lst name="responseHeader">    <int name="status">0</int>    <int name="QTime">0</int>    <lst name="params">        <str name="facet">true</str>        <str name="fl">        id,title,city,score,location_rating,introtext,location_rating_total,themes,features,official,services        </str>        <str name="indent">on</str>        <str name="start">0</str>        <str name="q">*:*</str>        <arr name="facet.field">            <str>province_raw</str>            <str>services_raw</str>            <str>themes_raw</str>           &

MOSS Search Not Returning Results from A List

Hello All,   Problem: The MOSS Search is not returning results from a subsite (and list within it). It however returns results for most of the other sites in the web application. Environment: 2 Application Servers. One of these is the index and query server. The same server is also the search server for the content databases. 5 web front end servers. Other Notes: The MOSS installation has several web applications. We however have one site within it that is not returning the required results. The results that we are looking for are located in a particular list. When one searches against the items in the list, some appear and others do not. We also get results from RSS feeds that track changes to the list in the last week. Also, some of the results returned are links to the new item in the list (that is, when you click on new to create a new item). There are no search errors in the application log. The web application was recently upgraded from WSS 3.0 on a single server to MOSS 2007 in a server farm. There are no sql index errors. The WSS Search and Office Search Services are working and have been restarted. The credentials have also been re-entered. We get less than 20 errors in the crawl logs (out of close to 800k docs). I have checked the rights for the default content access account, and it has dbo rights to the content db and search db. It also has read (and now admin

Why is SharePoint people search returning the same results as all sites search?


I've been having issues with the people search in that it doesn't return any results and the scope is 0.

I deleted the scope and recreated it adding the rule contentclass = urn:content-class:SPSPeople with behaviour : require but now when i search for people it seems to search everything not just people profiles. Please can someone tell me what I have done wrong when I recreated the scope? The scope still cant crawl the profiles but I'd like to at least get back to where i was before!!


SQL & JavaScript - Apostrophe Issue, SELECT statement is not returning any results.



Any help would be great on this.

I have the following code within an .asp page in JavaScript:

function SDsitecalls1(Sitename)

end function

The function is called via the below:

 <td style="width: 114px" class="style65"><a href="/suppdesk/customercalls.asp?customer=BSFMAN&site=Our+Lady''s+R+C+Sports+College"><%=SDsitecalls1("Our Lady's R C Sports College - Hbev")%></a></td> 

When this is ran I do not receive any errors but the SELECT command doesn't return any results (Just a 0). I've tried a few different methods such as using the Parameter SiteName and Single/Double Apostrophes however I either receive an error or blank results.

The function works with all other names however the apostrophe seems to cause issues here. Is there a way to extract the data without editing the SQL?

Thanks very much for the help,


Data List Returning Incomplete Results


Hi All

I have a page where users can search by company name, the data list is pulled from an Excel spreadsheet hosted on the site.  I'm seeing some strange results returned, for example:

In the company field say there are the following entries:

Anns Company
Bernards Business
Company B
Dermots Domain
Property Company

If I search for "Com" I get the following returns (correct):

Anns Company
Company B
Property Company

If I search for "Der" I get my "Sorry there are no matching results" message (Incorrect)

If I search for "Ann" I get the following returns (Correct):

Anns Company

And if I search for "e" I get the following returns (Correct):

Bernards Business
Dermots Domain
Property Company

It seems random as to why it doesn't return some values, I've tried moving rows around to see if that's the problem but it makes no difference.  My range is set correctly in the spreadsheet.

When I debug the VB code behind, when I search for something that works correctly e.g. "Com" in the above example, once enter the value and click search Visual Studio begins steping into

Sum Function Not returning proper results


I was wondering if someone could explain to me why this isn't returning the correct answer. 

Create View [dbo].[viewWyanAvail]


SELECT 'Wyan4' As TableGroup, Event_Type, Unit_Code, EventStartTS, EventEndTS, Avail_Cap 

FROM dbo.Wyan4 


SELECT 'Wyan5' As TableGroup, Event_Type, Unit_Code, EventStartTS, EventEndTS, Avail_Cap 

FROM dbo.Wyan5


SELECT 'Wyan6' As TableGroup, Event_Type, Unit_Code, EventStartTS, EventEndTS, Avail_Cap 

FROM dbo.Wyan6


SELECT 'Wyan7' As TableGroup, Event_Type, Unit_Code, EventStartTS, EventEndTS, Avail_Cap 

FROM dbo.Wyan7



Create FUNCTION [dbo].[fncGetDesignated_Amount_WyanAvail] (

	@TableGroup varchar(10),

	@Unit_Code varchar(5))




declare @Amount float

if not exists (select 1 from dbo.viewWyanAvail)

    select top 1 @Amount = Amount

 from dbo.Designated_Amount

Where Unit_Code = @Unit_Code


select top 1 @Amount = CAST(dbo.Designated_Amount.Amount AS Float) 

 FROM dbo.Designated_Amount INNER JOIN

 dbo.viewWyanAvail ON dbo.Designated_Amount.Unit_Code = dbo.viewWyanAvail.Unit_Code 

 WHERE not exists (SELECT 1

FROM dbo.Designated_Amount INNER JOIN

 dbo.viewWyanAvail ON dbo.Designated_Amount.Unit_Code = dbo.viewWyanAvail.Unit_Code

WHERE dbo.viewWyanAvail.Avail_Cap = 0 AND dbo.viewWyanA

Small Search Box Returning No Results




The small search box on the top page of the site returns no results, but when I do the same query in a search page, I get the expected number of results (more than zero).  I've poked around in the search settings on Central Administration, but I can't seem to find anything.  Has anyone run in to anything like this before?  Thanks!


CAST returning wrong results


Hi everyone,


I have a problem with the CAST. My code is this:


		CAST((1 + CAST((SELECT f2.Amount FROM FactSekas f2 WHERE f2.AccountChildCod = 'CL00100003' AND f2.Year = f.Year) AS DECIMAL(38, 18)) / 100) AS DECIMAL(38, 18)) AS DECIMAL(38, 18)) AS Rezult_18
		, CAST(CAST(f.Amount AS DECIMAL(38, 28))
		CAST((1 + CAST((SELECT f2.Amount 

SharePoint Search Not Returning Results

My SharePoint search is not returning results for anything but people. I'm not seeing any errors in the ULS log and my index contains rough 27,000 documents. What could be the problem? Where can I look for details that could shed some light on why there are no results being returned?

search not returning correct results


On my sharepoint, when I enter in bayliners in my search it returns me nothing related to bayliner boats, but when I enter in bayliner it returns me everything bayliner related, how can I get my search to return data for bayliner even though the user entered in bayliners in the search box?

My search results page is using an XSL file to show the data

Inplace Edit in GridView

In this article I am presenting a different way to look at EditItemTemplate, using which user navigation for editing is reduced and . it looks very different (see screeen shots) then regular implementation of GridView.

GridView Confirmation Box Using JQuery BlockUI in asp.net

JQuery is the most popular JavaScript library. One of the main reasons for its fame is the plugin architecture. Anyone can create a separate library that leverage the JQuery library. In this article we are going to look at the BlockUI library which is used to block the user screen while performing a task.

Textbox Editable GridView in ASP.NET

This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.
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