//Code Behind
public string GetTimerem( object pd)
{
DateTime d1 = Convert.ToDateTime(pd), d2 = DateTime.Now;
int d3, t3;
d3 = d2.Subtract(d1).Days;
t3 = d2.Subtract(d1).Hours;
// Label l1 = (Label)dlAdsList.Controls[0].FindControl("lblBuyTimeRem");
string timeRem = d3.ToString() + " Days " + t3.ToString() + " Hrs";
return timeRem; //l1.Text = "df";
//Label1.Text = d3.ToString() + " Days " + t3.ToString() + " Hrs";
// dtl.Text= _objDataTableAdsInfo.Rows[0]["PostDate"].ToString();
}
//aspx page
<asp:DataList id ="dlAdsList" runat ="server" >
< <ItemTemplate>
<asp:Label ID="lblTimeVRemainingAuction" runat="server" Text='<%# GetTimerem(DataBinder.Eval(Container.DataItem,"PostDate")) %>'></asp:Label>
</ItemTemplate>
</datalist>
public string GetTimerem( object pd)
{
DateTime d1 = Convert.ToDateTime(pd), d2 = DateTime.Now;
int d3, t3;
d3 = d2.Subtract(d1).Days;
t3 = d2.Subtract(d1).Hours;
// Label l1 = (Label)dlAdsList.Controls[0].FindControl("lblBuyTimeRem");
string timeRem = d3.ToString() + " Days " + t3.ToString() + " Hrs";
return timeRem; //l1.Text = "df";
//Label1.Text = d3.ToString() + " Days " + t3.ToString() + " Hrs";
// dtl.Text= _objDataTableAdsInfo.Rows[0]["PostDate"].ToString();
}
//aspx page
<asp:DataList id ="dlAdsList" runat ="server" >
< <ItemTemplate>
<asp:Label ID="lblTimeVRemainingAuction" runat="server" Text='<%# GetTimerem(DataBinder.Eval(Container.DataItem,"PostDate")) %>'></asp:Label>
</ItemTemplate>
</datalist>
No comments:
Post a Comment