When im populating my gridview exactly 10 data the design would be exact however, when no records found my gridview becomes bigger. How to set it exactly thesame ?
Sorry for the late postback . Anyway this is an example, take have a look on the image below thats what happen when below 10 records displayed in the gridview the header and columnds become huge so how am I able to fix the size of those headers and columns.
You are going to have to show us the ASPX markup, and any CSS that you are using?
It could be that you can add the EmptyDataTemplate to the GridView to account for when this happens, but you must be fixing the width and height of the GridView somewhere, and this is why you are seeing what you are.
Your GridView has a fixed width and height. When there is no data to be bound to the Grid, it still takes up all that space, and with nothing to fill it with, it looks the way you showed in the screen shot.
Try adding the EmptyDataTemplate to the GridView, with an appropriate message, and see if that helps.
What you are doing there is switching between the EmptyDataTemplate and the PagerTemplate for the purpose of editing those templates. Choose the EmptyDataTemplate, and then put "something" into it. How about a label, saying that there wasn't any data returned.
Yeep, If I'm not mistaken all I need to do is just like post #9. Then I noticed that theres a transparent box beside the panel so I'm trying to drag a label there but it doesn't work. So where am I going to add that label.
Sir I added the edittemplate in my code and included also the label. But nothings happen, when I search some records and the result were 2 datas still the look of my gridview is like in the post #3.
Sir just a quick question, but doing that edittemplate, when I query and the result were nothing, does it produce a 10 blank rows ? Cause my pageindexing number limited to 10.
Well I just resolved it temporarily, I just added a blank row in my datatable to look like this, even its no result or less than 10 result just to fixed the display row.
But if you have any other solutions then that maybe great, its good to have alternatives .
Yeep, I tried that, when there were no result it will display the label. But what I want to achieve is whether no results or less than data results I still want my gridview to display 10 rows, just like the attached image on my last post. But as I have said I figured it out by adding empty datarow in my datatable. But If you have a simple solution that would be a great help .
Because if theres no result at all. My design would turn out into just plain white and nothing but the buttons, yeah i know that is lame, but I just want to maintain the design that I've done .
Personally, I don't think that is a valid approach.
If there are no rows returned from your query, then you should indicate that to the user by putting "something" in the EmptyDataTemplate, not create empty rows simply for the sake of it.
Again, personally, I feel that this would be the wrong approach, but that is just my opinion. Why would I want to see a pop up message, that I will have to click on to make go away, when I could be shown this directly in the GridView.
This is really up to you. How you implement your site is your own opinion.
Within that particular template, you put the "stuff", i.e. a label, or something else, that you want the GridView to display, when there are no results returned from it's datasource.