DataControlField is an abstract class.which serves as base class for Gridview and Detailsview controls.
so Gridview and Detailsview has more similar funcationalities.the only difference between is data representation.
Derived types of DataControlFiled
BoundField,ButtionField,checkboxField,HyperlinkField,ImageField,commandField and TempletField are
derived types of DataControlField.
Ex : GridView1.columns.Add(DataControlField field)
Here DataControlFiled means which can be
BoundField,ButtionField,checkboxField,HyperlinkField,ImageField,commandField and TempletField so Add method accepts any of above field objects
Like :
BoundField empid=new BoundField();
GridView1.Columns.Add(empid);
ButtionField empname=new ButtionField();
GridView1.Columns.Add(empname);
------ ect. and same like for
DetailsView also Detailsview.Fields.Add(DataControlField field);
GridviewRow:
GridviewRow is used to represent a single row in Gridview control.
public class GridViewRow : TableRow, IDataItemContainer, INamingContainer
{
public GridViewRow(int rowIndex, int dataItemIndex, DataControlRowType rowType, DataControlRowState rowState);
public virtual object DataItem { get; set; }
public virtual int RowIndex { get; }
protected override bool OnBubbleEvent(object source, EventArgs e);
}
GridviewCollection:
public class GridViewRowCollection : ICollection, IEnumerable
{
public GridViewRowCollection(ArrayList rows);
public int Count { get; }
public GridViewRow this[int index] { get; }
public void CopyTo(GridViewRow[] array, int index);
public IEnumerator GetEnumerator();
}
Gridview Collection is collection of GridviewRows
foreach (GridViewRow item in GridView1.Rows)
{
GridViewRow gvr = GridView1.Rows[item.DataItemIndex];
ArrayList rowslist = new ArrayList();
rowslist.Add(gvr);
GridViewRowCollection gvrc = new GridViewRowCollection(rowslist);
IEnumerator ier = gvrc.GetEnumerator();
while (ier.MoveNext())
{
GridViewRow vrd = (GridViewRow)ier.Current;
}
}
public class ControlCollection : ICollection, IEnumerable
container controls maintain list of child controls in it so using which we can find the other controls.
Gridview1.Controls[0].controls[0];
Reapter.Controls[0].controls[0];
then i want to findout the Header and footer---Controls so
so Gridview and Detailsview has more similar funcationalities.the only difference between is data representation.
Derived types of DataControlFiled
BoundField,ButtionField,checkboxField,HyperlinkField,ImageField,commandField and TempletField are
derived types of DataControlField.
Ex : GridView1.columns.Add(DataControlField field)
Here DataControlFiled means which can be
BoundField,ButtionField,checkboxField,HyperlinkField,ImageField,commandField and TempletField so Add method accepts any of above field objects
Like :
BoundField empid=new BoundField();
GridView1.Columns.Add(empid);
ButtionField empname=new ButtionField();
GridView1.Columns.Add(empname);
------ ect. and same like for
DetailsView also Detailsview.Fields.Add(DataControlField field);
GridviewRow:
GridviewRow is used to represent a single row in Gridview control.
public class GridViewRow : TableRow, IDataItemContainer, INamingContainer
{
public GridViewRow(int rowIndex, int dataItemIndex, DataControlRowType rowType, DataControlRowState rowState);
public virtual object DataItem { get; set; }
public virtual int RowIndex { get; }
public virtual DataControlRowState RowState { get; set; }
public virtual DataControlRowType RowType { get; set; }protected override bool OnBubbleEvent(object source, EventArgs e);
}
GridviewCollection:
public class GridViewRowCollection : ICollection, IEnumerable
{
public GridViewRowCollection(ArrayList rows);
public int Count { get; }
public GridViewRow this[int index] { get; }
public void CopyTo(GridViewRow[] array, int index);
public IEnumerator GetEnumerator();
}
Gridview Collection is collection of GridviewRows
foreach (GridViewRow item in GridView1.Rows)
{
GridViewRow gvr = GridView1.Rows[item.DataItemIndex];
ArrayList rowslist = new ArrayList();
rowslist.Add(gvr);
GridViewRowCollection gvrc = new GridViewRowCollection(rowslist);
IEnumerator ier = gvrc.GetEnumerator();
while (ier.MoveNext())
{
GridViewRow vrd = (GridViewRow)ier.Current;
}
}
public class ControlCollection : ICollection, IEnumerable
container controls maintain list of child controls in it so using which we can find the other controls.
Gridview1.Controls[0].controls[0];
Reapter.Controls[0].controls[0];
<HeaderTemplate>
<asp:Label ID="lblHeader" runat="server" Font-Bold = "true" /><br />
</HeaderTemplate>
<ItemTemplate>
<%#Eval("Item1") %> - <%#Eval("Item2") %><br />
</ItemTemplate>
<FooterTemplate>
<asp:Label ID="lblFooter" runat="server" Font-Bold = "true" />
</FooterTemplate>
then i want to findout the Header and footer---Controls so
Control HTemplate = rptProducts.Controls[0].Controls[0];
Label lblHeader = HeaderTemplate.FindControl("lblHeader") as Label;
lblHeader.Text = "Header";
Control FooterTemplate=rptProducts.Controls[rptProducts.Controls.Count-1] .Controls[0];
Label lblFooter = FooterTemplate.FindControl("lblFooter") as Label;
lblFooter.Text = "Footer";
No comments:
Post a Comment