I have a Gridview and two link button in that GridView , one link button click is to add edit row ( Edit ), one link button click is to select row ( Select ). I have a dropdownlist inside row which selected when i click link button Select in the gridview edit template, as of my business logic i need to show the dropdownlist only when the user clicks Edit button and when the user clicks Select button . That mean when the user clicks Select button then they clicks Edit button on the gridvview i should allow him to edit the dropdownlist (showing the value to the user through a label).
When I click Select link button , then I click Edit link button . They have errors : Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index" I don't know what error?. How to fix it
Which one is faster? For a dropdownlist binding it the first time and using ViewSate or Turning of viewstate, keeping the data in a static datatable and binding the dropdownlist each time on a postback
I have dynamically popute the data in Dropdownlist(Countries) and the On selected index event of Dropdownlist there is noeed to bind /populate the Checkbox list from database depending on the selections made from the Dropdownlist.
For example If I select Gujrata then all the cities of Gujrat should be visible and bounded to the check box list.
2) Once the checkbox list is bounded with data from the database, We need to select the checkbox from the checkboxlist and pass tyhe selected text of all the selected checkboxes fro the checkbox list as comma seperated values to database and then I need to Display in the Grid.
Below is my code for Dynamically populated/Bind DropDown list and get the States:
I need a bit of help with a scenario. I am working on a web application that requires huge amounts of data to be Added, Deleted, and Updated. The data entry forms are divided into logical groups through Multiviews. All the information is saved when the mighty Finish button is pressed. The current setup (previous developer) does not allow me to use transactions. Therefore, if I am to save a new Courier to the database, I need to add his/her Distance and Rate info. In addition, I need to add his/her Banned Areas info (Area Name, Post Code).This is where it gets interesting. Obviously, the DistamceAndRate table and the BannedArea table in my SQL Server will have the CourierID as a foreign key. Since I'm going to save the Courier as well as the Rates and Areas info in one go, I cannot have the newly created CourierID before. Therefore, I cannot bind my Grids for Distance + Rates and Banned Areas directly to database.What I am doing is creating two DataTables and managing them in Viewstate through properties as follow:
So, on page load, the DataTables are initialized with a blank schema. Here are the attempted CRUD implementations (Distance and Rate only):
I am having issues when I am canceling a new entry and when I am editing a new entry. In addition, for Distance and Rates, Rate is acting as unique (cannot be repeated) and attempting to control that is also giving me a headache. I end up creating blank rows.And here's the ASPX cut-out:
Hope to get an answer soon.Also, off-topic, I'm using LINQ here. In order to save a Courier and his/her extra details, I first save his/her address to DB. Then I take the ID of the address and save the courier. now the courier ID is avaliable and i start filling extra tables related with the courier table. If something goes wrong, I have to manually delete created rows. LINQ uses transaction internally but only until a SubmitChanges() call. I'm forced to save each entity so I keep calling SubmitChanges().I tried manual transaction but after saving the address inside a transaction, the Address.OID (Address table's mapped prime-key) had a 0. attempting to use this newly added address while saving Courier in the same transaction threw an exception. If there is a way to get the primary key for entities created in a transaction that is yet to be commited, please mention that'll as well.
I am trying to use a datasource with a dropdownlist. Eventually, my data source method to call a stored procedure and load the datatable is returns, but for now, I am just creating the datatable manually. I need each item to have two attributes, the text, whixh the user will see in the DDL, and the value that the program will retrieve from and store back to the file.
It is partly working in that the DDL has 3 items, however the text for each item reads "System.Data.DataRowView"
I have to be close, but I can't figure out what I am doing wrong.