We can search any type of control in header templete through item_databound event of repeater like this.
protected void rptElective_ItemDataBound(object sender, RepeaterItemEventArgs e)
{
if (e.Item.ItemType == ListItemType.Header)
{
Label lblSelect = (Label)e.Item.FindControl("lblSelect");
if (SpecFlag == false)
lblSelect.Visible = true;
else
lblSelect.Visible = false;
}
}
And also you can Hide Control without Item_dataBound like this enjoy coding...
Label lblSelect = rptElective.Controls[j].Controls[j].FindControl("lblSelect") as Label;
Tuesday, September 27, 2011
Wednesday, September 21, 2011
Convert string to datetime exactly not normal datetime.
The unexpected error was come once in front of me.string was not in a valid datetime format.Then i searched for this conversion and it works properly now.
DateTime dt = DateTime.ParseExact(txtdob.Text, "dd/MM/yyyy", null); ;
DateTime dt = DateTime.ParseExact(txtdob.Text, "dd/MM/yyyy", null); ;
Tuesday, September 20, 2011
Select checkboxlist according to db get values
This is very simple example for splitting and selecting checkbox list according to the values get by database field.
string[] value = DocValues.Split(',');
foreach (string st in value)
{
if (chkdocument.Items.FindByText(st).Text != string.Empty)
{
chkdocument.Items.FindByText(st).Selected = true;
}
}
string[] value = DocValues.Split(',');
foreach (string st in value)
{
if (chkdocument.Items.FindByText(st).Text != string.Empty)
{
chkdocument.Items.FindByText(st).Selected = true;
}
}
Friday, September 16, 2011
format datetime in any container
//We can format our date time string into our desired format in any container like this:-
asp:Label ID="lblDOB" runat="server" Text='<%#Eval("DOB","{0 :MM/dd/yyyy}") %>'asp:Label
asp:Label ID="lblDOB" runat="server" Text='<%#Eval("DOB","{0 :MM/dd/yyyy}") %>'asp:Label
format datetime in any container
//We can format our date time string into our desired format in any container like this:-
asp:Label ID="lblDOB" runat="server" Text='<%#Eval("DOB","{0 :MM/dd/yyyy}") %>'asp:Label
asp:Label ID="lblDOB" runat="server" Text='<%#Eval("DOB","{0 :MM/dd/yyyy}") %>'asp:Label
Subscribe to:
Posts (Atom)