Multiple ListBoxes and insert form - asp.net

I want to create multiple listboxes when you select the first it does a database query which gets a list for the second list box and it carries on for the third and so on. Beside each list box is a form to insert an entry for that list is there an article or video on how to do this. Some ajax might be needed to do what I want Im not really sure what to do I can't find an article on this. does anyone have any links for me

You want the functionality like what would be done in Cascading DropDownList except that your control is ListBox.
See samples and Ideas there, it could be helpful.

Related

ASP.Net, how to put hyperlinks in datagrids.

Hi i have a datagrid I've put in on a aspx web form in visual studio 2010, I'm new to this so I've been following the ms tutorials.
One of the columns on my data grid contains a lot of information, is there a way i can add a "+more" option in the cell next to the entry that shows only the first few characters of that cell, but once clicked opens all the information on that particular entry but onto a new aspx form?
Thanks for any help!!
There are basically three different ways...
Structure your data object/query so that it returns a key and and abbreviation (i.e, first name, last name, id, bio) and use a template that turns id into a link.
Use the onrowbound event to manipulate the controls on the row, so that you have a href to your details page.
Use css to show the additional info on a hover/mouse over (I like this, but it doesn't play well with mobile devices, which don't have either event).
EDIT: Methods 1&3 would be done on your aspx page, method 2 would be done in the codebehind for your page. Method 1 is really dependent upon your being able to control the data object/ query results. If you are calling a stored proc that someone else controls, it may be very difficult to make it work.

Telerik RadGrid Manipulating data from data source before databinding an item

I am working with a Telerik Radgrid on an aspx page, which basically has to bind to a datatable, which gets populated by data returned from a web service. I need to be able to fill out some of the columns in the RADGRID based on the data returned by the web service.
For example, I need to be able to build the Hyperlink column based on the parts data returned by the web service. I need a way to access the datasource before the grid item gets populated and direct execution to a routine which builds the URL for the parts on a website.
Can anybody please suggest an efficient way to do this?
I highly appreciate any help/suggestions.
Thanks
Karthik
(Moving my comment to an answer, because I'm thinking this will work out for you.)
You could always cheat and bind it to the grid, allowing you to access the data, but then hide the columns so the users could never get the data.
Let me know how it works out.
EDIT:
My select statement is "select top 5 ProductName from products"
I then created a hyperlink column and assigned the properties under the data tab as such.
When run, it makes the data clickable and when clicked, it navigates to the url seen in the SS.
That what you need?

Can database fields be dragged and dropped (as textboxes, not a gridview) into an ASP.Net form?

In VisualStudio, when you drag and drop a table or an individual column from a data connection in server explorer, a gridview is created.
What I want to be able to do is drag and drop the columns to make a quick and dirty detail form to display an individual record. Is this possible in any way?
An even better way to do this would be via a custom T4 or LLBLGen template but I have no clue how to do this.
Any other suggested approaches?
UPDATE: A DetailsView is the type of thing I am looking for, in that you can select a data source and the specific columns you want, but I'd like to be able to have manual control of the layout and formatting after the initial drag and drop.
I suggest binding a DetailsView to the table using a data source (SqlDataSource) instead. You might find these tutorials, especially this one helpful.
In response to your update, have a look at the FormView control. It gives you complete control of the layout using templated sections.
There appears to be literally no way to do this in VS that I have come across.

Can I move the automatically generated Edit and Delete columns ASP.Net to the end of the table?

I am using ASP.Net 2.0. I am using a gridview component over some data because I wanted to get the paging functionality it provides. The rest of my site where I do not need to provide paging because I have used an alphabetical index or because the result set is small enough to fit in the screen I use a repeater. In the repeater I have added the delete shortcut to the end of the table in its own cell. The edit link is provided by clicking on any row in the results and that takes you to a new screen where you can edit the details.
I have not been able to find a way to move the edit and delete columns to the end. Is there perhaps a property that I missed or is the easiest way of doing this going to be extending the Gridview component. If that is the case would it better to extend the component or try and write my own paging functionality to acompany my repeater.
Rather than using the autogenerate delete and edit buttons, you can manually add an edit and delete field using the 'Edit Columns' dialogue from the gridView smart tag. Make sure that Auto Generate fields is not selected and you can then add your columns as desired, and edit, delete and insert are all available as children of the CommandField option.
The best solution of them all would be to get the paging capablilities into your data access solution, so that if you need page 3 you only get those ten records and not the entire list. That way you could also use a repeater to render the list, without having to extend it with paging capabilities - just add another repeater at the bottom that loops out the page numbers as links.
However, if this is not possible, the easiest way would probably be to manually configure the GridView to render the way you want it to (or as close as possible...). It's been a while since I worked with a GridView, but the names I show below are at least close enough for you to find the correct ones with Intellisense in VS.
First, set
AutoGenerateColumns = False
on your GridView. Then, add a <Columns></Columns> section betweeen the <asp:GridView></asp:GridView> tags. Within that section, you should be able to specify each field you want to render, and the order you want them in.

ASP.net 2.0 Gridview with Expanding Panel Rows -- How to build Panel "on the fly"

I'm currently building a Gridview that has expandable rows. Each row contains a dynamically created Panel of Form elements. Right now, I have a javascript function that expands (or in my case, makes visible) the panel when an Image is clicked on the Gridview row.
My question is... is there a more efficient way of doing this. Instead of pulling all my data to begin with and building each new row as I Databind, is there a way to simple create the row with the Panel full of textboxes and dropdownlists on the fly when the user clicks the Expand button?"
I'd like to limit the server calls by doing it that way instead of how I'm currently doing it, looping through every row and creating a new panel with form elements and inserting that into a row that is hidden.
Actually, it isn't performing badly since my original SQL query can populate every single row and I have enabled paging on the Gridview. I'm just wondering if they can be built on the fly using PageMethods or some sort of JSON/AJAX solution. I haven't seen anything, but... worth a try in searching for it.
you can override the RowdataBound event, and than add whatever controls you want based on what data goes in the cell.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.rowdatabound.aspx
Personally trying to create the data on the fly would most likely result in a slower user experience.
When I do things like what you are describing I typically use Repeaters, that way I can do a template layout that simply defines all of the needed elements right away, and it handles the binding actions.
Otherwise, I would imagine that your way isn't performing too slowly as it is.
Actually worked this recently into an AJAX Handler returning the form structure. It's on demand, and works well. Simply call $ajax via jQuery, return an HTML structure, inject into DIV. It's a bit limiting on actual functionality, so be careful.

Resources