Forms Data Controls :: EmptyDataTemplate And EmptyDataText Not Working In GridView

Jun 9, 2010

I can't seem to get either EmptyDataTemplate or EmptyDataText of a GridView to work. I'm fetching the GridView contents in de codebehind and attaching them with using DataBind(). I've tried having them as null and as an empty List, and in both cases the text I put intoEmptyDataTemplate or EmptyDataText is not displayed. What am I doing wrong?

EDIT (Code snippet) This is my GridView:

<asp:GridView ID="grid" runat="server" EmptyDataText="EMPTY"></asp:GridView>

And I've tried these two for binding the data:

grid.DataSource = new List<object>();grid.DataBind();grid.DataSource = null;grid.DataBind();

View 5 Replies


Similar Messages:

EmptyDataTemplate And EmptyDataText Not Working In GridView

Jun 3, 2010

I can't seem to get either EmptyDataTemplate or EmptyDataText of a GridView to work. I'm fetching the GridView contents in de codebehind and attaching them with using DataBind(). I've tried having them as null and as an empty List, and in both cases the text I put into EmptyDataTemplate or EmptyDataText is not displayed. What am I doing wrong?

EDIT (Code snippet) This is my GridView:

<asp:GridView ID="grid" runat="server" EmptyDataText="EMPTY">
</asp:GridView>

And I've tried these two for binding the data:

grid.DataSource = new List<object>();
grid.DataBind();
grid.DataSource = null;
grid.DataBind();

View 2 Replies

Forms Data Controls :: GridView EmptyDataTemplate Or Emptydatatext - Can't See "No Result Found"

Jul 12, 2010

[Code]....

But i can not see "no result found". Why? I am using .net 3.5! The same with emptydatatext...

View 15 Replies

CSS - Friendly Control Adapters Removes EmptyDataTemplate And EmptyDataText

Oct 4, 2010

As pointed out in the question:

EmptyDataTemplate and EmptyDataText not working in GridView

using CSS-Friendly Control Adapters removes the data that would would be populated by EmptyDataTemplate or specified in EmptyDataText in GridView. One of the solutions is to disable the addapters for GridView components as specified in this answer Is there a solution, that would allow to keep the use of CSS-Friendly Control Adapters for GridView and still take advantage of EmptyDataTemplate functionality?

View 2 Replies

Forms Data Controls :: Style For Emptydatatext In Gridview

Dec 19, 2010

i want to show my style(for example font color) when gridview is empty.i want to make style for emptydatatext. is it possible?

View 5 Replies

Forms Data Controls :: Gridview With EmptyDataText Property Set

Apr 28, 2010

Does somebody have a clue about my following issue? I have a gridview with it's datasourceid set to "ods". I have two objectdatasources. One is called "ods" which contains a list with all contracts. The second objectdatasource is called "odsAuthorized" which contains a list with all authorized contracts.

Now i have two linkbuttons "Show All " | "Show Authorized" whith an onClick event where i set the datasourceid of the grid.

When i click the "show authorized" i see a list of all contracts which are authorized. Now when i click on "Show all" is see a list with all contracts. So the onClick events work fine, however. When i change the status in the database so i have 0 authorized contracts, and click on the "Show Authorized" i get to see a label which says "Sorry no records have been found" because i have set the EmptyDataText property on the gridview. Now when i click on Show All, the onclick event for the Show All button never gets fired. I do see that a postback occurres. But i don't come into the event. Does anybody have a logica for this?

View 7 Replies

Forms Data Controls :: Using Gridview - Alter EmptyDataText Results

Jul 10, 2010

I am working on a site using .aspx controls. Currently I am working on a search feature which searches my database of records and produces all applicable results to the search. Everything works as planned. I have recently added the EmptyDataText line to produce a specific output anytime no results are found in the database. However, I would like to be able to alter/change the appearance of the EmptyDataText output and cannot figure out how to do so. For example, if no results are returned from the search, I would like the EmptyDataText to produce an output of something along the lines of "Your search has produced zero results.

double check your spelling and try your search again." I would like to change the font color, font size, and possibly the thin box which is automatically produced around this output. Is any of this possible? If not, is there another way to produce the desired results? Ultimately, I would actually like to have the results actually use the terms which were input to the search within the EmptyDataText results when no search results are found within my database. For example, if "widget" was used as a search term and "widget" was not found within my database then i would like the results page to state something along the lines of: "Your search for 'widgets' did not return any results. check the spelling and try your search again." Does anyone know how to do any of these things using ASP.Net?

View 1 Replies

Forms Data Controls :: Reset Gridview To Display EmptyDataText String

Mar 26, 2010

I have a DropDownList when selected, brings up Detail Info in GridView1. That GridView has a LinkButton when selected brings up the final Detail Info, in GridView2. need to have the GridView2 clear out and display as when it is "EmptyDataText", when the DropDownList is changed.

View 5 Replies

Forms Data Controls :: Gridview 'EmptyDataText' Text Not Showing When No Records Returned

May 5, 2010

using asp.net/vb.net 2005

In the aspx page I have the EmptyDataText property set

[Code]....

However when no records are not returned I am not seeing the text "No Results Returned" I am populating the gridview using a SqlDataSource. I am not sure why this is happening but thinking about setting the value programmatically, does this make sense and if yes which gridview event should I do this? has anyone else experienced something like this before?

View 19 Replies

Forms Data Controls :: Using GridView's EmptyDataTemplate To Insert New Row?

Jul 6, 2010

There is user selected search criteria used to display both a FormView (Invoice header information such as ship_id, vendor, date, store, etc...) and cooresponding GridviewDetails (product details such as upc, description, unit cost, qty ordered, qty received, etc...) There is a one to many relationship between 1 invoice (formview) and many product details (gridview). I need to add the ability to insert product details to a particular invoice (ship_id is the link between the 2 tables) if an invoice currently doesn't have any. I have the emptydatatemplate programmed with dropdownlists and textboxes to capture the user entered information along with a submit button. However the insert doesn't occur.

I know the problem is how I am (incorrectly) using the findcontrol, but for the life of me I can't seem to find the correct syntax (been searching the forums for nearly a weeks implementing different syntax and testing to no avail!)

I have successfully implemented the ability to insert a new row using the footertemplate and was banking on some of that code to assist me with the insert of new details in the emptydatetemplate. Grrrrr....still not working. Below is the current version of the test page programming.

Code behind for the OnClick button in the emptydatatemplate "submit": (note: I know at least part of the problem is in how I am attempting to find the controls. Here is where I can not find a syntax that works and I have tried several dozen versions...)

[Code]....

GridviewDetails EmptyDataTemplate programming is below:

[Code]....

I've also included my entire GridViewDetails programming just in case it helps to read what it is that I am trying to do:

[Code]....

And here's the entire code behind that I have so far to make everything else function as desired:

[Code]....

View 3 Replies

Forms Data Controls :: GridView: Adding Links To EmptyDataTemplate?

Aug 17, 2010

I have a grid view (using sqldatasource & C#) which returns no rows. By design asp.net does not show header/footer. I looked at couple of sites and suggestions and found it to be too complex. Nothing was simple. The one I found was to create a empty datatable, insert rows and bind it to the gridview. But that code does notwork for me because I am using sqldatasource and using datatable gives error.I decided to just add the following to empty item template.

<EmptyDataTemplate>

<div>
<asp:Label Text="No details found." runat="server"> </asp:Label>[code]....

THe link shows up in the bottom but the event gridview_RowCommand is not fired as the grid view is not created or it does not have rows

How do I call a function on click the add new link and put all my code in there to insert possibly using a modal popup. I cannot use onclientclick because it is javascript.

View 8 Replies

Forms Data Controls :: How To Set Label Contained Within EmptyDataTemplate In Gridview

Feb 9, 2011

I have the following setup, but i would like to make the empty text more specific, so just looking to have it display the same message but with the selected value text from the drop down as part of the messages.

so if you select say the 2nd item from the drop down, then i would like to have the empty label(if empty of course) display "There are No Records for Last 24 hrs"

[Code]....

[Code]....

[Code]....

View 2 Replies

Forms Data Controls :: Can Assign The Values To Textbox Of Gridview EmptyDataTemplate

Jun 7, 2010

can we assign the values to textbox of Gridview EmptyDataTemplate ? if yes, how can you assign. pls give the coding also.

View 5 Replies

Forms Data Controls :: Getting A Gridview To Generate Thead And Tbody While An Emptydatatemplate Is Being Used?

Dec 17, 2010

I have a curious issue,I am using a combination of asp.net controls with Jquery and am using the JQuery plug called datatables. Instead of applying this to a html table, I applied it to an asp.net gridview. To get it to work, I had to add the thead and tbody tags to the grid like so in the c#:

tablename.UseAccessibleHeader = true;tablename.HeaderRow.TableSection = TableRowSection.TableHeader;

The issue is, is when data is filtered in the table, often there are no results and the emptydatatemplate is used. When this occurs the thead and tbody tags are not in the source outputted by the browser, and an occur occurs and the jquery does not function. Error: 'asSorting' is null or not an objectDoes anyone know a solution? I need to use both the gridview and the jquery datatables ideally.

View 1 Replies

Forms Data Controls :: Can Do Javascript Validation On Gridview Emptydatatemplate Controls

Sep 22, 2010

The requirement is like the users should enter data and should be able to see the entered data before final save. So, I've taken a gridview and binded it to a temptable which will don't have any data initially, so on the first page load the datasource will be empty and the emptydatatemplate will be shown to the user. On this EmptyDataTemplate I've prepared a dataentry screen where the user can give the information and can save the data. After saving the data the data will go to the temptable and the gridview will get populated with the data the user has entered. For next go, the user can enter records through the gridview footer row. In this way I'm doing my things.

Now I haven't done the validation yet, I wanted to do a validation of the user input on gridview emptydatatemplate and gridview footer as well. In order to do that I've created one Button object on RowDataBound and assigned the gridview emptydatatemplate save button against it and also binded one javascript function with this button like below.

[Code]....

The javascript is working fine and returning boolean values based on the validation done.

But the problem is after I did this validations the RowCommand event of my gridview is not firing. I'm inserting this records on this event only based on the commandname of the button. But if I remove this javascript validation everything works fine for me.

View 3 Replies

Forms Data Controls :: Setting EmptyDataText From Code Behind

Jun 10, 2010

I would like to be able to set the EmptyDataText property using code-behind. I have created a custom GridView control called PagingGridView. Here is the definition:

public class PagingGridView : GridView {
}

In my ASPX page, I would created a new GridView definition by doing this:

<cc:PagingGridView id="MyGrid" runat="server" ><cc:/PagingGridView>

When I databind the control, I would like my custom control to automatically detect an empty data source and build a table with all the header columns and a row containing the empty data text. The rendered code for the empty data source would be like:

<table>
<tr>
<td>Col1</td><td>Col2</td>
</tr>
<tr>
<td colspan="2">No Records to display</td>
</tr>
</table>

My initial thought was to override the EmptyDataText property but I could not get that to work.

View 3 Replies

Forms Data Controls :: EmptyDataText Property Ignored When Page Loads For The First

Nov 3, 2010

I've got a dropdownlist and a Gridview Based on the choice from the dropdownlist (which has a '--Select--' as the first item), the gridview is populated. If nothing is in the database when queried, I have a message for the emptydatatext property of the gridview. However, it comes up when the page first loads, since it's based on the ddl. How can I make it so that, when the page loads for the first time, the emptydatatext property is ignored?

View 3 Replies

Forms Data Controls :: Get FormView To Use InsertItemTemplate Instead Of EmptyDataTemplate?

Jul 30, 2010

The situation: a FormView with an EditItemTemplate and an Insert Item Template. When the page is entered and a record exists in the datasource, everything is fine with the Formview in Edit mode and the Edit ItemTemplate being used. But when no record is present, the FormView uses the EmptyDataTemplate even though it was switched it to Insert mode. Here is the code used to switch modes, fired in the OnDataBound event:

protected void SetModeAndHeadings(object sender, EventArgs e)
{
if (FormView1.DataItemCount == 0)
{
FormView1.ChangeMode(FormViewMode.Insert);
}
else
{
FormView1.ChangeMode(FormViewMode.Edit);
}
etc...
}

Is the problem that it switched to Insert mode too late? What has to be done differently here to automatically switch between Edit and Insert modes?

View 2 Replies

Forms Data Controls :: How To Disable Buttons In EmptyDataTemplate

Oct 27, 2010

i want to disable some buttons in my emptydata template. i tried using this code but it cant find the control. thus returning an error Specified argument was out of the range of valid values.

Button btnsaveini = (Button)grdNonSerialized.Controls[0].Controls[0].FindControl("btnSave1");
btnsaveini.Enabled = false;

View 3 Replies

Forms Data Controls ::add New Records In The ListViews EmptyDataTemplate?

Apr 28, 2010

Could someone please point me to a tutorial that explains how to add new records in the ListViews EmptyDataTemplate

View 1 Replies

Forms Data Controls :: How To Navigate From EmptyDataTemplate To Other Templates In ListView

Oct 1, 2010

All the writeups on ListView's EmptyDataTemplate say that it's for displaying the fact that no data records exist, which is logical; but the bad thing is that I've found nothing as a follow-up. In other words, I haven't been able to find any "now what?" once you (as the site user) find that there aren't any data records. I am led to then ask what the real purpose of the EmptyDataTemplate is if you can't do anything with it.

I added a button called "Add Your Photo" on the EmptyDataTemplate, which activates a ModalPopupExtender with an AsyncFileUpload. All this works fine in terms of uploading the file but nothing happens after that. I wonder if I should be starting instead in the InsertItemTemplate.

So, I need to know how to accomplish a couple of options: I need to start out in either the InsertItemTemplate or the EmptyDataTemplate. If I do the latter, I will need to know how to get from there to the ItemTemplate so the rendering can be displayed.

What code should I use to display the data--that is, how do I move from the EmptyDataTemplate to the ItemTemplate?

View 19 Replies

Forms Data Controls :: Load EmptyDataTemplate Of FormView On PageLoad?

Nov 4, 2010

There is a page having formview with inserttemplate loading after user authentication. I have created user id = guest. If anyone login with guest i want to be load page FormView with EmptyDataTemplate.

View 11 Replies

Forms Data Controls :: ListView DataPager Only Pages To The EmptyDataTemplate?

Jan 6, 2010

There have been a few datapaging questions tonight, but mine is a bit different..

I have a regular datapager, in a seperate project it seemed to work fine with the same query and templates, but when I use it in my page, whenever the I try to page I get the emptydatatemplate when there should be data..

Here is my current ListView

[Code]....

I have tried binding data OnPreRender and setting the page properties under the OnPagePropertyChanging events.. still only getting my empty template whenever i navigate through the pages when there should be plenty of data..

View 1 Replies

Forms Data Controls :: Accessing The DropDownList Control In The EmptyDataTemplate?

Jan 15, 2011

I have a DropDownList in the InsertItemTemplate of the DetailsView in EmptyDataTemplate. I want to acces the value of the DropDownList control and insert its value in the empty DataBase.

View 6 Replies

Forms Data Controls :: Search Label Control In EmptyDataTemplate In Listview?

Jul 26, 2010

How to access lable control inside the EmptyDataTemplate in Listview while dataset is empty to show message?

View 6 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved