How To Dynamically Bind Data With Different Dropdownlist In A Grid View
Mar 28, 2010
i am wking on an assignment in which i have a gridview that contain deptno in a dropdownlist.by selecting a particular deptno from that dropdownlist,the number of employee of that department displayed in second dropdownlist that is for displaying employyee of a department.And after selecting the employee its salary detail and date of joining displayed in textboxes?we have two database table one is for employee(fields are deptno,empname,salary,joining date,status(true/false))and second department(fields are deptno,deptname,location);;;
I am developing an application using ASP.NET with C#.NET.in my application i have a gridview control and radobutton list having the values as Manufacturer and Distributor. based on the radiobutton selected value,the gridview will bindedup.
i am using SQL SERVER 2005 as backend server. in my database i have one table with columns as
My gridview has 3 columns as Opendate,closedate,awarddate.
if user select the radiobutton as manufacturer,only mfropendate,mfrclosedate,mfrawarddate have to bind. and if user select the distributor the remaining 3 fields will have to bind. for that i had write a storedproc as create procedure sp_GetDraftBids as begin select mfropendate as opendate,mfrclosedate as closedate,mfrawarddate as awarddate, distopendate as opendate,distclosedate closedate,distawarddate awarddate from draftbids end GO
i.e i had taken the alias names for that fields so that i will bind the only 3 columns to grid view as opendate,closedate,awarddate.
My gridview code is
here i had taken the same alias names as i have to bind only 3 columns to gridview.when i run my application i am getting the records in data table with column names as opendate,closedate,awarddate,opendate1,closedate1,awarddate1.i.e it does not allow the same alias name.
for two radio button conditions i.e for manufacturer and distributor the gridview binded with opendate,closedate and awarddate columns as i had binded the gridview boundfields withat names.
but when user select the distributor radiobutton i have to bind the opendate1,closedate1 and awarddate1 to the gridview. for that should i can i change the storedproc are any other solution is there?
My requirement is i want to bind data to gridview2 which is placed in gridview1..Iam using EDM objects to refer database...So for Gridview1 Iam getting out put...now how to bind to gridview2...For gridview1 I binded the data which is in onetable...And for gridview2 i want to bind MENU table data...so how can i bind the data...
this is the gridview2..in gridview1 row.
I also tried using FindControl() but iam not able to proceed further.
I have a GridView control that has a SQLDataSource.
The GridView provides me with a list of musical artists (from the tblArtists)
In the Grid, I have a field, FKGenreID, that is a Foreign Key value for music Genres.
(An example of the data in that field would be "7", which upon lookup would mean Classical in the tblGenreList table.)
What I'd like to do is add a DropDownList control that looks up the tblGenreList table and populates the DropDownList with the ID and Description from the tblGenreList Lookup table.
Now the tricky part is that if the GridView field (FKGenreID) has a value, then I'd like the corresponding Genre Description to be displayed in the DropDownList
Alternately, if there is no value for FKGenreID in the GridView, then I'd like the DropDownList to show that nothing was selected, but have the list of Genres available.
Most importantly here, when the user makes a selection, I'd like the GenreID (from the DropDownList) to be entered into the FKGenreID field in the GridView field.
My thought is that a gridview record may or may not have a value in the FKGenreID field. Either way, the DropDownList is bound to that field. The DropDownList would display a list ofGenre Descriptions for the user to select from. Upon selection, the GenreID column of the DropDownList becomes the value in for the FKGenreID field in the GridView.
Is this possible?
In case it matters, I'm using ASP.NET 4, Visual Studio 2010, and coding in VB
I have a problem ,i want to 2 dropdownlist box on a form and one will take loaded from data at the time of pageload and data of second dropdownlist box will change according to selected item in first dropdownlistbox ,and after that gridview will dynamicaly bind from some data according to choosen data of second dropdownlistbox .
I uses lots of code but i am not able to dynamicaly bind dropdown and gridview
I created 3 category table. categry1,categry2,categry3. product table.
And then use of gried view add ,edit ,update ,delete product . in product table.
In gridview retrive data from product table . i select categry from dropdownlist in gridview categry1, categry2, categry3 and save update dropdown list category value dynamically in product table. not define value static in source code.
When select category 1 change on selected index change categary 2 or 3.
In my code I used text box to ediit update delete. but here i will use dropdownlist.
I have a gridview, in an update panel, that's populated by an object data source when the page loads. This same Grid View is going to use a different data source and slightly different columns collection at runtime. The columns collection will be very similar, with one column added and three removed. Is this the best way to do this?
The other solution would be to create another grid view and data source to use when needed. The two Grid Views can be toggled off and on to use the correct one as needed. I've done this and it worked well, as far as I can tell. I'm curious if there are performance implications because of the additional Grid views and data sources. Or, if there are other reasons not to do this.
Which of these two ways is the best way to do this? Should I toggle between the two Grid Views at runtime or modify the grid view(datasource and columns) at runtime in the code behind?
i am making one application..in that i want to use dynamic pager or custom pager.i have two dropdown list one for Data per page and second to change the Page..how to achieve paging using this two dropdown list.
Need row editing on page_load for all the cells and need to validate each cell entry. Means cell1 one entery isvalid it fills thrid cell and insert or update to a table in the database. How do i handle on tab clicking to update in databse.
I want my gridview columns to have fixed width. Even though data is long,i want it to be shown only till the width permits. Further, I want to provide tool tip, so user can see full value in that. I don't want wrap to happen. Fixed width is working but data wraps. I tried all types. But no results.
I have a grid view that displays some diary data that consists of a date, a diary entry and a diary entry type (eg holiday, info, meeting..)How can I change the background colour of a row depending on the diary entry type.So for example if the type is 'holiday' colour the row yellow, if its 'meeting' colour it red etc etc