rpd rpd - 1 month ago 11
ASP.NET (C#) Question

Dynamic Buttons / Dynamic Button Container on Server Side

I have a Asp.net project having a combobox that have many car groups. However, I want to change it with divided buttons with image on them. But also I have to this buttons make dynamic so that user can add new car groups.

Is it possibble if I don't want to use Ajax requests ? If I can How can I do that ?

Also I have a devexpress. If it is possible with devexpress it also would be ok for me

Thanks in advance for all :) I'm really rookie about web coding. Sorry If I am wrong about some parts.

My combobox code if that helps (I also use objectdatasource for combobox):

<dx:ASPxComboBox ID="txtUrunGrubu" AutoPostBack="true" runat="server" style="margin-top: 0px" Font-Size="Medium" Width="250px" OnSelectedIndexChanged="txtUrunGrubu_SelectedIndexChanged">
<ItemStyle Font-Size="Medium" />
</dx:ASPxComboBox>

Answer

you can do something like this

foreach(string fileName in fileEntries)
{
ibImageList = new ImageButton();
ibImageList.ImageUrl = GetDirectoryName(fileName);
ibImageList.Width = new Unit(125, UnitType.Pixel);
ibImageList.CommandName = GetDirectoryName(fileName);
//Add it to the panel
pnlImages.Controls.Add(ibImageList);
pnlImages.Controls.Add(new LiteralControl("<br>"));
}