Free Support Forum - aspose.com

Finding problem with aspose.pdf



namespace CollapsiblePanelInsideGridview
{
public partial class DynamicallyCreatingItemTemplate : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
BindGrid();
}
protected void BindGrid()
{

SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings[“con1”].ToString());
DataSet ds = new DataSet();
SqlDataAdapter ad = new SqlDataAdapter(“select * from Categories_Temp”, con);
ad.Fill(ds, “Categories_Temp”);


BoundField f = new BoundField() { DataField = “categoryname”, HeaderText = “categoryname” };

gv1.Columns.Add(f);

TemplateField tfObject = new TemplateField();
tfObject.HeaderText = “Header Text”;
tfObject.HeaderStyle.Width = Unit.Percentage(30);
tfObject.ItemTemplate = new CreateItemTemplate(ListItemType.Item);
gv1.Columns.Add(tfObject);

gv1.DataSource = ds.Tables[“Categories_Temp”].DefaultView;
gv1.DataBind();

}

}

public class CreateItemTemplate : ITemplate
{

//Field to store the ListItemType value
private ListItemType myListItemType;

public CreateItemTemplate()
{
//
// TODO: Add default constructor logic here
//
}

//Parameterrised constructor
public CreateItemTemplate(ListItemType Item)
{
myListItemType = Item;
}

//Overwrite the InstantiateIn() function of the ITemplate interface.
public void InstantiateIn(System.Web.UI.Control container)
{
//Code to create the ItemTemplate and its field.
if (myListItemType == ListItemType.Item)
{
ImageButton imgbtn = new ImageButton(){ ID=“LinkButton1”};
container.Controls.Add(imgbtn);
CollapsiblePanelExtender clpe = new CollapsiblePanelExtender()
{
ID="",
TargetControlID=“Panel1” ,
CollapsedSize = 0,
ExpandedSize= 300,
Collapsed=true,
ExpandControlID=“LinkButton1”,
CollapseControlID=“LinkButton1”,
ScrollContents=true,
ExpandDirection= CollapsiblePanelExpandDirection.Vertical,
SuppressPostBack=true,
ExpandedImage="~/images/images1.jpg",
CollapsedImage="~/images/images.jpg",
ImageControlID=“LinkButton1”

};
container.Controls.Add(clpe);
Panel pnl = new Panel() { ID = “Panel1” };
pnl.Controls.Add(new Label(){ ID=“L1” ,Text=“ABC”});
container.Controls.Add(pnl);

}
}

}
}

Hi Amit,


Thanks for contacting support.

Please share some details regarding the issue which you are facing. We are sorry for your inconvenience.