So I'm setting the attribute for listItems that are then added to the dropdown when page loads based on some condition...so not all the listItems will have the same attribute as pxVal will be different for each item. I'm basically trying to make it look
like a treeview control. However, when I try to add the selected item to gridview, the postback occurs and the attribute styling is gone. So I was trying to rebind the list but I don't want to duplicate the records so I cleared the items first and readded
them to the list. The problem is, ddlControl.Items.Clear method make a linkbutton I have in a gridview control not fire. Any ideas why a rowcommand event won't fire? I'm binding the gridview on a button click event and then calling the function to clear
the dropdownlist items and repopulate it...
According to your description, I couldn’t understand your requirement clearly.
Could you please post the details aspx codes and the code-behind make up?
<div>
If you post more details information and codes, it will be more easily for us to reproduce your issue and find out the solution.
Best regards,
Yijing Sun
</div>
.NET forums are moving to a new home on Microsoft Q&A, we encourage you to go to Microsoft Q&A for .NET for posting new questions and get involved today.
Member
95 Points
427 Posts
attributes in dropdown lost after postback
Nov 19, 2019 11:38 PM|inkaln|LINK
Hi,
So I'm setting the attribute for listItems that are then added to the dropdown when page loads based on some condition...so not all the listItems will have the same attribute as pxVal will be different for each item. I'm basically trying to make it look like a treeview control. However, when I try to add the selected item to gridview, the postback occurs and the attribute styling is gone. So I was trying to rebind the list but I don't want to duplicate the records so I cleared the items first and readded them to the list. The problem is, ddlControl.Items.Clear method make a linkbutton I have in a gridview control not fire. Any ideas why a rowcommand event won't fire? I'm binding the gridview on a button click event and then calling the function to clear the dropdownlist items and repopulate it...
li.Attributes.Add("style", "padding-left:" + pxVal + ";");
Contributor
3730 Points
1412 Posts
Re: attributes in dropdown lost after postback
Nov 20, 2019 07:34 AM|yij sun|LINK
Hi inkaln,
According to your description, I couldn’t understand your requirement clearly.
Could you please post the details aspx codes and the code-behind make up?
<div>If you post more details information and codes, it will be more easily for us to reproduce your issue and find out the solution.
Best regards,
Yijing Sun
</div>