Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
vijay_kerji@yahoo.com #1
DataGrid with Dropdown list
Any Help is appreciated!
I have a datagrid with Drop down list and a remove hyperlink as two
columns.
When I remove the row of the datagrid by clicking on the remove
column,Dropdown list is mentaining its previous state.
i.e Removed dropdownlist's selected value is applied to the next
datagrid item's dropdown list.
DATAGRID
---------------------------------------------------------
"Remove" | "<DropDownList1>"
---------------------------------------------------------
"Remove" | "<DropDownList2>""
When the first row is removed, "DropDownList2" becomes
"DropDownList1"!!!
How to solve this problem?
Thanks
Vijay
vijay_kerji@yahoo.com Guest
-
Dropdown list
I would like to display 15 items (lines) in the dropdown list, but by default the list displays only 11 lines. How can I have all the 15 items... -
How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the datagrid Update event.
How to add a Dropdown list to a datagrid at runtime (dynamic) without using template columns in ASP.NET and still have the ability to us the... -
Refresh dropdown list
On a cfform I have a cfselect dropdown . The situtation is that when an option isn't listed I have a "Add button" next to the drop down that... -
Tool Tip for DropDown list
Hi, I have a dropwnlist of fixed width. The item names in the dropdown list are quite big. The Tooltip property for a dropdownlist control... -
bounding for dropdown list in datagrid
Hello, I put a dropdown list in ItemTemplate Column. I can select its value from the dropdown list and store in a dataset, but when I retrieve... -
Samuel Kim #2
Re: DataGrid with Dropdown list
Can you pls post some of the code you are using?
Samuel Kim Guest
-
Samuel Kim #3
Re: DataGrid with Dropdown list
Can you pls post some of the code you are using?
Samuel Kim Guest
-
Vijay Kerji #4
Re: DataGrid with Dropdown list
"Samuel Kim" <look341@gmail.com> wrote in message news:<1108806189.308298.233670@g14g2000cwa.googleg roups.com>...
Hi,> Can you pls post some of the code you are using?
The following code is used in the 'remove' hyperlink click handler.
foreach(DataGridItem DemoGridItem in dataGrid_AddUsers.Items)
{
DropDownList myDDList =
(DropDownList)DemoGridItem.Cells[3].Controls[1];
string selectedValue =
((DataGridUser)this.userList[index]).userRole;
//Check if the program is in edit or create
//If it is in edit, disable the datagrid item row and do not add
PM as dropdownlist item.
if ("ProgramEdit" == programModeValue)
{
if(selectedValue == "PM")
{
myDDList.Items.Add("PM");
DemoGridItem.Enabled = myDDList.Enabled = false;
myDDList.Items.FindByText(((DataGridUser)this.user List[index]).userRole).Selected
= true;
//myDDList.SelectedValue
=((DataGridUser)this.userList[index]).userRole;
} //if the role is null which is a bug in DB
else if (selectedValue == "")
{
myDDList.Items.Add("Sub PM");
myDDList.Items.Add("CBA");
myDDList.Items.Add("Stake Holder");
}
else //since we are in edit mode, add all except PM
{
myDDList.Items.Add("Sub PM");
myDDList.Items.Add("CBA");
myDDList.Items.Add("Stake Holder");
myDDList.Items.FindByText(((DataGridUser)this.user List[index]).userRole).Selected
= true;
//myDDList.SelectedValue
=((DataGridUser)userList[index]).userRole;
}
}
else //we are in create mode, add all the values to the list.
{
myDDList.Items.Add("PM");
myDDList.Items.Add("Sub PM");
myDDList.Items.Add("CBA");
myDDList.Items.Add("Stake Holder");
//set the selected value
myDDList.Items.FindByText(((DataGridUser)this.user List[index]).userRole).Selected
= true;
//myDDList.SelectedValue
=((DataGridUser)userList[index]).userRole;
}
index++;
}
Hope it is readable.
Thanks
Vijay
Vijay Kerji Guest



Reply With Quote

