I'm a new to ASP.net. Sorry if this problem is so simple with some people.
In my webpage, main frame includes two smaller frames: leftcol, centercol. In centercol I want to show the news (sort by day, time) loaded from SQL DB. I want the news showing like that:
I really dont know which Control in ASP.net is suitable??? Datalist, Listview???
1.you can try using repeater.
repeater sample
2.Gridview..
Gridview Sample
U can use these two controls to fetch and display data..MOreover you can do paging and sorting based on criteria by defining properties..Apart from this you need to make few styles inorder to have your own look..
Related
Requirement is to have 50000 checkboxes in an aspx page .
Currently I have implemented it in aspx , the page is slow and the selection is very slow, at times the application hangs. The load is too much.
Currently the page size is 10 mb I need to reduce that too.
I am looking for an alternative approach like jquery or something keeping in mind that I will need to use checkboxes.
Things I have tried which didn't help the cause:
ASPX list box
Html div- checkbox
Infragistics
Iframe.
Would appreciate any answer.
If you're trying to select the checkboxes using code in your code behind, that's going to be slow because it's a back-end solution for what should happen in the front-end. Even if you set up pagination so you display only 50 checkboxes at a time, it'll still be slow if you're doing the checking in the code behind. To select checkboxes with jQuery, which is a much faster solution, try something like this:
$(document).ready(function () {
$('#body').on('click', 'input[type=submit]#uxSelectAll', function () {
$(this).toggleClass("checked");
var isChecked = $(this).hasClass("checked");
$('input[type=submit]#uxSelectAll').val(isChecked ? "Unselect All" : "Select All");
$(this).prev().find(":checkbox").prop("checked", isChecked);
return false;
});
});
Here you have a Select All button that checks and unchecks the checkboxes on click. You can select the checkboxes with a selector like this:
$(this).find(":checkbox").prop("checked", true);
Note: This question assumes that you're using as your checkboxes.
Firstly, if you are rendering 50k checkboxes/rows I'd suggest there's some refactoring that could be done on the design? Maybe you could consider higher level groupings of rows, and have a fewer number of checkboxes update a collection of related entities/rows?
But if you do need to the 50k checkboxes, you may want to consider pagination to separate them into pages of reasonable amounts.
So, as you said you're using an aspx page, I'll assume it's a web forms application. If that's the case, you can use the GridView control to manage the pagination for you (examples at http://quickstarts.asp.net/QuickStartv20/aspnet/doc/ctrlref/data/gridview.aspx, there is also a paging example at that link).
I have a images with hits column in sql table. I want to show images on a webpage like a gallery when an visitor clicks on it it redirect to another page which shows its detail and when visitor clicks on the image it also increase the hits...... I tried it with gridview but that unfullfill the requirements. kindly tell me the best way?
I would consider using list view control
List view control with Images example
I have Designed this gallery :http://ultimatedesign.in/UserGallery.aspx
Follow this post you get the idea
http://www.aspdotnet-suresh.com/2013/04/display-images-in-aspnet-gridview-from.html
I have a dynamic number of Gridviews created based on user-entered data. Each of the Gridviews has its own header row, and I want the user to be able to sort individual GridViews by clicking on a particular column's header. I've been having trouble writing an OnClick_sort method to reference the particular GridView and that data. Also, I want this to be done on Client-side instead of being passed back to the server, so I need to write the Sort method in a JavaScript, correct? Each GridView has a unique ID, generated when adding the GridView to the control.
You can do that by sing Jquery. Refer This...
http://www.aspsnippets.com/Articles/Scrollable-GridView-with-Fixed-Headers-and-Client-Side-Sorting-using-jQuery-in-ASP.Net.aspx
http://www.aspsnippets.com/Articles/Filter-GridView-Records-using-DropDownList-in-HeaderTemplate-Header-Row-in-ASPNet.aspx
You should keep in memory the elements of the grid and sort it using your code (handling events and etc). But, the magic is: you should put your grid in a updatePanel, so your code will be translated to a script that will execute on the cliente side. If your code is too complex to run on the cliente, it will comunicate with the server without your intervension.
Is that? ;)
I have requirement in my application where I am struck . These is my scenario:
Initially I need to show up two text boxes with a check box and a button. upon clicking the button we need to generate one more row. Like wise we need to create multiple rows dynamically.
Initially I tried with Table Control but after struggling a lot, I came to know that we can create only one row dynamically using Table Control. So now I am planning to do in repeater control.
In this kind of scenario, it would be better to use the GridView Control Instead, take a look here some working examples:
http://www.revenmerchantservices.com/page/gridview-add-new-row.aspx
http://amitpatriwala.wordpress.com/2008/04/18/inserting-new-row-in-gridview-in-aspnet-20/
I have a gridview on my page that gets bound to user search results. There can be many pages upto say 1000. Each page shows 50 records. I have the built in paging turned on for the grid. I want to disable the viewstate on the grid but then I have to bind the results on every page load. (bind twice on paging). The search takes a few seconds and I would not want to store the results in the session. So, how do I achieve turning off the viewstate for the grid or is it okay to have it enabled?
This must be a very common scenario. I hope there is a standard way of doing this.
Depending on how you bind the grid view you should implement server side paging so that your only bringing back the data from the server you need to display for one page.
What data access are you using i.e. are you using linq to sql?
Heres an article on how to do it with ObjectDataSource Custom paging and sorting
Avoid where ever possible putting large amounts of info into view state as it will bloat your page and effect performance.