Currently, I have a dynamically templated RadGrid. The RadGrid's commandItemTemplate is created during runtime.
In
this case, the ImageButton will appear on the left of the command
template and the LiteralControl will be next to the ImageButton. How can
I position the LiteralControl in the middle of the
CommandItemTemplate?
I created the CommandItemTemplate using the ITemplate interface as shown below. Appreciate some help on positioning the LiteralControl to be in the middle/center of the CommandItemTemplate.RadGrid1.MasterTableView.CommandItemTemplate = new CustomCommandItemTemplate(tableName);
//The CustomCommandItemTemplate class
public class CustomCommandItemTemplate : ITemplate
{
private string tableName;
public CustomCommandItemTemplate(string tableName)
{
this.tableName = tableName;
}
public void InstantiateIn(System.Web.UI.Control Container)
{
ImageButton imgAdd = new ImageButton();
imgAdd.ID = "add_button";
imgAdd.CommandName = "InitInsert";
imgAdd.ImageUrl = "~/Images/add.png";
Container.Controls.Add(imgAdd);
LiteralControl lit = new LiteralControl(tableName);
lit.ID = tableName;
Container.Controls.Add(lit);
}
}