View Complete Post
I have a DropDownList inside the EditTemplateItem (if the user clicks edit) in a GridView. The DropDownList receives all available rows from the database.
My problem is, if the user clicks Edit in the GridView to edit a row and opens the DropDownList Box the original item is not selected but the first one. That means the items are sorted.
Have someone an idea how I can solve this issue that the right item / the original is selected if I change to edit mode of the grid view?
The only idear that I have is to write some lines in the code behind for the updating event and selected the suitable index manually but I think there must be an easier way.
I am using gridview, in ItemTemplate I am using dropdownlist which has the hard-coded value, I want to get updated value of dropdownlist from database, but whenever I use EVAL, it throws the following error:
'ddl' has a SelectedValue which is invalid because it does not exist in the
list of items.
Parameter name: value
I am using the following code:
<asp:TemplateField HeaderText="Status" >
<asp:DropDownList ID="ddl" runat="server" SelectedValue='<%# Bind("Status")%>' >
I have Gridview and Button Control on Form.i want to Add Dynamically TextBox And DropDownList In Gridview on Button Click Wich is placed outside of Gridview.
When i click on Button -> One TextBox and One Dropdownlist which contains values bydefault 1,2,3 should bind to gridview. Button is placed outside Gridview.
Thanks in advance.
Hi, I got information from here quite often.
I just want to share my experience this time and hope it might help someone someday.
I have a DropDownList in my GridView's PagerTemplate.
I used the example code from http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.gridview.pagertemplate(VS.80).aspx
I used it in many of my pages. All works fine except one.
The OnSelectedIndexChanged event just isn't fired in that one page.
Later I set the "EnableViewState" of that GridView to false, it works finally.
I am creating a gridview with 1 dropdown(Item),1 label(rate),2 Text bob (quantity,total amount).
problem is that dropdown and label access records from one database table.
on the basis of dropdown selection item rate label display rate of that item.
then user insert quantity and amount calculated base of item quantity and rate. and row is autogenerated or by command button for other item.
i am unable to solve this task how can i do this plz help.
I'm creating a GridView that displays the details of an order. One of the columns shows which Location the order went to. All the information is correctly displayed and is based on a single SQL query (SqlDataSource1).
When they edit the item, I have another SQL query (SqlDataSource2) that correctly pulls a list of all the customer's locations and populates a DropDownList. The issue I'm having is trying to set the SelectedValue of the DropDownList to the Location value, which is pulled in the first SQL query.
Here's what I've been working with so far...