Using "TabContainer" and "TabPanel" Ajax Toolkits - c#

I have a few tabs on a page and it always defaults to the first tab , but when a link is clicked i want it to select a diferent tab using javascript. How can I select the tab with Javascript?
Right now, because the default is selecting the first tab, javascript throws an error that either pnlTab2 is not visible or does not exist. But if I manually click on the tab and then on the link it focuses on that tab correctly?
I am new in C# and Javascript, can anyone please help me?, how can I select the second tab using javascript and then focus so that it does not give me error?
Thank you
function DoFocus() {
var pnlTab1 = document.getElementById('<%=pnlTab1.ClientID%>');
var pnlTab2 = document.getElementById('<%=pnlTab2.ClientID%>');
if (pnlTab2 != null ) {
//I WANT TO SELECT THE TAB HERE
document.getElementById('<%=pnlCustomerReviews.ClientID%>').focus();
}
else {
//OR SELECT THIS ONE
document.getElementById('<%=pnlTab2.ClientID%>').focus();
}
return false;
}
<asp:UpdatePanel ID="UpdatePnl" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<ajaxToolKit:TabContainer runat="server" id="myTabs" CssClass="CustomTabStyle">
<ajaxToolKit:TabPanel ID="pnlTab1" runat="server" HeaderText="Tab 1">
<ContentTemplate>
<table>
<tr>
<td>
<div class="Tab1">
<asp:Label ID="lblPnl1" runat="server"></asp:Label>
</div>
</td>
</tr>
</table>
</ContentTemplate>
</ajaxToolKit:TabPanel>
<ajaxToolKit:TabPanel ID="pnlTab2" runat="server" HeaderText="Tab2">
<ContentTemplate>
<table>
<tr>
<td>
<div class="Tab2">
<asp:Label ID="lblPnl2" runat="server"></asp:Label>
</div>
</td>
</tr>
</table>
</ContentTemplate>
</ajaxToolKit:TabPanel>
</ajaxToolKit:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>

Try this: http://forums.asp.net/t/1127834.aspx

Related

ListView's SelectedIndexChanging event inside an UpdatePanel causes a whole page reloading

I have a ListView that's inside a UpdatePanel, UpdateMode = Conditional:
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table>
<tr>
<td>
<asp:ListView ID="SearchListView" runat="server">
<LayoutTemplate>
<div id="scrollDiv" onscroll="SaveScrollPosition();">
<table>
<tr>
...
</tr>
</table>
</div>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td align="right">
<asp:LinkButton ID="lblUnitItem" runat="server" CommandName="Select"></asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<SelectedItemTemplate>
<tr>
<td align="right">
<asp:LinkButton ID="lblUnitItem" runat="server" CommandName="Select"></asp:LinkButton>
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
Selecting a list item cause the whole page reloading instead of partial page refresh.
I bound the listview to the datasource in the method "FillSearchListView", and implemented the "OnSearchListViewItemCommand" and "OnSearchListViewSelectedIndexChanging" events:
protected void OnSearchListViewSelectedIndexChanging(object sender, ListViewSelectEventArgs e)
{
((ListView)sender).SelectedIndex = e.NewSelectedIndex;
FillSearchListView();
}
protected void OnSearchListViewItemCommand(object sender, ListViewCommandEventArgs e)
{
switch (e.CommandName)
{
case "Select":
ListViewDataItem dataItem = (ListViewDataItem)e.Item;
this.CurrentId = decimal.Parse((string)e.CommandArgument);
break;
}
}
Any ideas why this isn't working? Thanks.
In the new version of ASP.NET changes the ID generation of a control inside a container like ListView.
Triggers on UpdatePanel doesn't work for fix this.
Simply put ClientIDMode="AutoID" in your linkbuttons (or another control), so the postback will be async.
Hi use triggering in the update panel
here is the code
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table>
<tr>
<td>
<asp:ListView ID="SearchListView" runat="server">
<LayoutTemplate>
</LayoutTemplate>
</asp:ListView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="SearchListView" EventName="SelectedIndexChanged" />
</Triggers>
</asp:UpdatePanel>
Add attribute: ChildrenAsTriggers="true"
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="true" >
See childerenastriggers here
try this
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<table>
<tr>
<td>
<asp:ListView ID="SearchListView" runat="server">
<LayoutTemplate>
<div id="scrollDiv" onscroll="SaveScrollPosition();">
<table>
<tr>
...
</tr>
</table>
</div>
</LayoutTemplate>
<ItemTemplate>
<tr>
<td align="right">
<asp:LinkButton ID="lblUnitItem" runat="server" CommandName="Select"></asp:LinkButton>
</td>
</tr>
</ItemTemplate>
<SelectedItemTemplate>
<tr>
<td align="right">
<asp:LinkButton ID="lblUnitItem" runat="server" CommandName="Select"></asp:LinkButton>
</td>
</tr>
</SelectedItemTemplate>
</asp:ListView>
</td>
</tr>
</table>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="SearchListView" EventName="SelectedIndexChanging" />
<asp:AsyncPostBackTrigger ControlID="SearchListView" EventName="ItemCommand" />
</Triggers>
</asp:UpdatePanel>

Why my update panel does not work?

i have an update panel that contains a checkBox and a panel, checkbox's auto postback property is true, and i want to make panel visible when checkbox is checked , but when i'm clicking on the checkbox page is refreshed :(
Code:
<asp:UpdatePanel runat="server" ID="updDate">
<ContentTemplate>
<tr>
<td>
<br/>
Website Status
<br/>
</td>
<td>
<br/>
<asp:CheckBox runat="server" ID="chkUnderConstruction" Text=" Is Website Active?"
AutoPostBack="True"></asp:CheckBox>
<br/>
</td>
</tr>
<asp:Panel runat="server" ID="pnlDate">
<tr>
<td>Activation Date</td>
<td>
Day: <asp:TextBox runat="server" ID="txtDate" Width="30">
</asp:TextBox>
Month: <asp:TextBox runat="server" ID="TextBox1" Width="30">
</asp:TextBox>
Year : <asp:TextBox runat="server" ID="TextBox2" Width="30">
</asp:TextBox>
</td>
</tr>
</asp:Panel>
</ContentTemplate>
</asp:UpdatePanel>
PageLoad code :
pnlDate.Visible = chkUnderConstruction.Checked;
try adding triggers to update pannel
<Triggers>
<asp:AsyncPostBackTrigger />
Try to use Jquery for that.
Avaoid writing server side code for it. In Jquery there are function for this like Show() and Hide().
You can refer those function over here>>
http://api.jquery.com/show/
Create Jquery function based on check box event to hide and show your panel.
Your problem will definitely get resolved.
Use this it will work very fine for you . I am using this in my project
<script type="text/javascript" language="javascript">
function onUpdating() {
// get the update progress div
var updateProgressDiv = $get('updateProgressDiv');
// make it visible
updateProgressDiv.style.display = '';
// get the gridview element
var gridView = $get('chkUnderConstruction');
// get the bounds of both the gridview and the progress div
var gridViewBounds = Sys.UI.DomElement.getBounds(gridView);
var updateProgressDivBounds = Sys.UI.DomElement.getBounds(updateProgressDiv);
// do the math to figure out where to position the element (the center of the gridview)
var x = gridViewBounds.x + Math.round(gridViewBounds.width / 2) - Math.round(updateProgressDivBounds.width / 2);
var y = gridViewBounds.y + Math.round(gridViewBounds.height / 2) - Math.round(updateProgressDivBounds.height / 2);
// set the progress element to this position
Sys.UI.DomElement.setLocation(updateProgressDiv, x, y);
}
function onUpdated() {
// get the update progress div
var updateProgressDiv = $get('updateProgressDiv');
// make it invisible
updateProgressDiv.style.display = 'none';
}
</script>
<asp:UpdatePanel ID="UpdatePanelTabContainer" runat="server">
<ContentTemplate>
</ContentTemplate>
</asp:UpdatePanel>
<ajaxToolkit:UpdatePanelAnimationExtender ID="upae" BehaviorID="animation" runat="server"
TargetControlID="UpdatePanelTabContainer">
<Animations>
<OnUpdating>
<Parallel duration="0">
<%-- place the update progress div over the gridview control --%>
<ScriptAction Script="onUpdating();" />
<%-- disable the search button --%>
<EnableAction AnimationTarget="btnSubmit" Enabled="false" />
<%-- fade-out the GridView --%>
<FadeOut minimumOpacity=".5" />
</Parallel>
</OnUpdating>
<OnUpdated>
<Parallel duration="0">
<%-- fade back in the GridView --%>
<FadeIn minimumOpacity=".5" />
<%-- re-enable the search button --%>
<EnableAction AnimationTarget="btnSubmit" Enabled="true" />
<%--find the update progress div and place it over the gridview control--%>
<ScriptAction Script="onUpdated();" />
</Parallel>
</OnUpdated>
</Animations>
</ajaxToolkit:UpdatePanelAnimationExtender>
I found it!, my mistake. i didnt use triggers, the right code :
<asp:UpdatePanel runat="server" ID="updDate" UpdateMode="Conditional">
<ContentTemplate>
<tr>
<td>
<br/>
Website Statuse
<br/>
</td>
<td>
<br/>
<asp:CheckBox runat="server" ID="chkUnderConstruction" Text=" Is Website Active?" AutoPostBack="True"></asp:CheckBox>
<br/>
</td>
</tr>
<asp:Panel runat="server" ID="pnlDate">
<tr>
<td>Activation Date</td>
<td>
Day: <asp:TextBox runat="server" ID="txtDate" Width="30"></asp:TextBox>
Month: <asp:TextBox runat="server" ID="TextBox1" Width="30"></asp:TextBox>
Year: <asp:TextBox runat="server" ID="TextBox2" Width="30"></asp:TextBox>
</td>
</tr>
</asp:Panel>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="chkUnderConstruction" />
</Triggers>
</asp:UpdatePanel>

Asp.Net repeater control with javascript

I have created FAQ page using Repeater Control, The questions and Answers are bound Run-time from Code Behind as Follows.
ASPX code
<asp:Repeater ID="RepDetails" runat="server">
<ItemTemplate>
<table id="tblRepeater">
<tr id="QARow" runat="server">
<td>
<div id="QuestionDiv" onclick="return show(this, 'AnswerDiv');">
Q:<asp:label id="lblQuestion" runat="server" Text='<%# Eval("Question")%>' CssClass="lblQueClass"></asp:label>
</div>
<div id="AnswerDiv" style="display:none;">
Ans:<asp:Label id="lblAnswerClass" runat="server" Text='<%# Eval("Answer")%>' CssClass="lblAnswerClass"></asp:Label>
</div>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
It Works great ! The thing is i have used following Script for opening and closing the Answer.
<script type="text/javascript">
function show(QuestionDiv, AnswerDiv) {
var arrDIVs = QuestionDiv.parentNode.getElementsByTagName("Div");
for (var i = 0; i < arrDIVs.length; i++) {
var oCurDiv = arrDIVs[i];
if (oCurDiv.id.indexOf(AnswerDiv) >= 0) {
var blnHidden = (oCurDiv.style.display == "none");
oCurDiv.style.display = (blnHidden) ? "block" : "none";
}
}
return false;
}
</script>
It works like, when clicked on One Question It shows the answer of that question.
My Question is: I want to update the script so as when we click on One particular question, It should display the Answer of that question, also it should hide the Answer of other Question.(like http://www.edubrainschool.com/faq.php).
The best way for that would be to bind click of that TR. You can do this by applying a css to the TR.
<asp:Repeater ID="RepDetails" runat="server">
<ItemTemplate>
<table id="tblRepeater">
<tr id="QARow" runat="server" class="TROpenCSS">
<td>
<div id="QuestionDiv" class="QuestionCSS" onclick="return show(this, 'AnswerDiv');">
Q:<asp:label id="lblQuestion" runat="server" Text='<%# Eval("Question")%>' CssClass="lblQueClass"></asp:label>
</div>
<div id="AnswerDiv" class="AnswerCss" style="display:none;">
Ans:<asp:Label id="lblAnswerClass" runat="server" Text='<%# Eval("Answer")%>' CssClass="lblAnswerClass"></asp:Label>
</div>
</td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
And the bind the click event of those CSS
$('.TROpenCSS').bind('click',function(){
// Do your code to show the TD
});
Add other bind for all clicks / mouseover
Or you can use "ddaccordion.js" or refer to the following link

JavaScript method not working in ASP.NET User Control

I asked a question before about a JavaScript code you can see it here : How can I scroll down to a multiline TextBox's bottom line, Javascript's scrollIntoView is not working for this. Well, it was solved and the accepted answer was working.
Afterwards I had to move the code part you can see in that question to a User Control which finally looked like this :
<%# Control Language="C#" AutoEventWireup="true" CodeBehind="LiveChatPart.ascx.cs" Inherits="BeyzamComArayuz.LiveChatUserControl.LiveChatPart" %>
<%# Register src="/LiveChatUserControl/GenelOdaFlashPart.ascx" tagname="GenelOdaFlash" tagprefix="gOF" %>
<script language="javascript" type="text/javascript">
function buttonClicked() {
// var el = document.getElementById("TxtBxOdaMesajlari");
var textBox = $get("TxtBxOdaMesajlari");
textBox.scrollTop = textBox.scrollHeight;
// $get("TxtBxOdaMesajlari").scrollIntoView("false");
}
</script>
<asp:ScriptManager ID="ScrptMngr" runat="server"></asp:ScriptManager>
<tr>
<gOF:GenelOdaFlash runat="server"></gOF:GenelOdaFlash>
<td valign="top" align="left">
<table>
</table>
</td>
<td valign="top" align="left">
<table>
<tr>
<td>
buraya imajlar gelecek - chip vs.
</td>
</tr>
<tr>
<td>
<asp:ListBox ID="LstBxOdadakiKullanicilar" runat="server"
Width="175" Height="281" Enabled="false">
<asp:ListItem Value="1" Text="Bir"></asp:ListItem>
</asp:ListBox>
</td>
</tr>
<tr>
<td>
<asp:UpdatePanel ID="UpdtPnlButtonlar" runat="server">
<ContentTemplate>
<table>
<tr>
<td>
<asp:Button ID="ButtonOdadanCik" runat="server" Text="Odadan Çık" Width="175" Height="22" />
<asp:Button ID="ButtonHediyeGonder" runat="server" Text="Hediye Gönder" Width="175"
Height="22" />
<asp:Button ID="ButtonFullEkran" runat="server" Text="Full Ekran" Width="175" Height="22" />
<table>
<tr>
<td>
<asp:Panel ID="PnlKontroller" runat="server" GroupingText="Kontroller"
Visible="false">
<table>
<tr>
<td>
<asp:Label ID="LblChatTuru" runat="server" Text="Ücretsiz!"></asp:Label>
</td>
</tr>
<tr>
<td>
<asp:Button ID="BttnSohbetTuruDegistir" runat="server"
Width="175" Text="Sohbet Türü Değiştir"
OnClick="BttnSohbetTuruDegistir_click" />
<asp:Button ID="BttnMolaVer" runat="server"
Width="175" Text="Mola Ver" OnClick="BttnMolaVer_click" />
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<asp:Button ID="ButtonOzelSohbet" runat="server" Text="Özel Sohbet" Height="108"
Width="175" OnClick="ButtonOzelSohbet_click" />
<asp:Panel ID="PnlOzelSohbetKamera" runat="server" Visible="false">
<asp:Label ID="asd" runat="server" Text="zsa"></asp:Label>
<div id="ozelOdaKamera" style="height: auto; float: left;">
<script type="text/javascript" src="/jwplayer/swfobject.js"></script>
<script type="text/javascript">
// For version detection, set to min. required Flash Player version, or 0 (or 0.0.0), for no version detection.
var swfVersionStr = "11.1.0";
// <!-- To use express install, set to playerProductInstall.swf, otherwise the empty string. -->
var xiSwfUrlStr = "playerProductInstall.swf";
var flashvars = {};
var params = {};
params.quality = "high";
params.bgcolor = "#FFFFFF";
params.allowscriptaccess = "sameDomain";
params.allowfullscreen = "true";
var attributes = {};
attributes.id = "uyeOzelOdaKameraFlash";
attributes.name = "uyeOzelOdaKameraFlash";
attributes.align = "middle";
swfobject.embedSWF(
"/Images/uyeOzelOdaKameraFlash.swf", "ozelOdaKamera",
"220", "150",
swfVersionStr, xiSwfUrlStr,
flashvars, params, attributes);
// <!-- JavaScript enabled so display the flashContent div in case it is not replaced with a swf object. -->
swfobject.createCSS("#flashContent", "display:block;text-align:left;");
</script>
</div>
</asp:Panel>
</td>
</tr>
</table>
</td>
</tr>
<tr>
<td style="padding-left:8px;">
<asp:UpdatePanel ID="UpdtPnlMesajlar" runat="server" EnableViewState="true">
<ContentTemplate>
<table>
<tr>
<td>
<table>
<tr>
<td>
<%--<div id="satir">--%>
<asp:TextBox ID="TxtBxOdaMesajlari" runat="server"
ReadOnly="true" TextMode="MultiLine"
Height="100" Width="350">
</asp:TextBox>
<%--</div>--%>
</td>
</tr>
<tr>
<td>
<asp:TextBox ID="TxtBxMesaj" runat="server" Width="285"></asp:TextBox>
<%--this is the button which should run the javascript function--%>
<asp:Button ID="BttnGonder" runat="server" Text="Gönder"
Width="58" OnClick="BttnGonder_click"/>
</td>
</tr>
</table>
</td>
<td valign="top">
<asp:Panel ID="PnlAktiviteKayitlari" runat="server"
Visible="false" GroupingText="Aktivite Kayıtları">
<table>
<tr>
<td valign="top">
<asp:ListBox ID="LstBxAktiviteKayitlari" runat="server"
Enabled="false" Width="128">
<asp:ListItem Value="1" Text="Bir giriş yaptı"></asp:ListItem>
</asp:ListBox>
</td>
</tr>
</table>
</asp:Panel>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
</td>
</tr>
And in asp.cs file I have
protected void BttnGonder_click(object sender, EventArgs e)
{
string cariId = "";
if (KullaniciTuru == 1)
{
cariId = Session["ModelId"].ToString();
}
else
{
cariId = Session["UyeId"].ToString();
}
string uyeHesapAdi = BAL.Cari.Cari.GetCariHesapAdi(int.Parse(cariId));
string mesaj = uyeHesapAdi + " : " + TxtBxMesaj.Text;
TxtBxOdaMesajlari.Text = TxtBxOdaMesajlari.Text + Environment.NewLine + mesaj;
//TxtBxOdaMesajlari.Focus();
ScriptManager.RegisterStartupScript(this, this.GetType(), "txtbxmesajlarslide", "buttonClicked();", true);
TxtBxMesaj.Text = string.Empty;
}
My problem is that buttonClicked() function is not working anymore, I tried to use Page.ClientScriptManager.RegisterClientScriptInclude from ScottS's answer and also this Page.ClientScript.RegisterClientScriptBlock, neither of them worked.What can I do?
EDIT: I tried to debug the webpage with IE9's built in debugger and put a breakpoint in the buttonClicked() function but it was never hit.Then I used the OnClientClick event of the button and added buttonClicked function to it it works for each click but then textbox just jumps back to where it was before buttonClicked() function.
The issue is that ids for controls on a user control are somewhat mangled in that they include the user control's id plus the actual control's id. So your control's id probably looks something like: ucLiveChatPart_TxtBxOdaMesajlari.
The easy way to handle this is to change this line:
var textBox = $get("TxtBxOdaMesajlari");
to:
var textBox = document.getElementById('<%= TxtBxOdaMesajlari.ClientID %>');
Now, if you extract your javascript into a separate file or you want to use a different approach, you can emit the control id into a javascript variable from codebehind and use that instead.
In codebehind:
ScriptManager.RegisterStartupScript(this, this.GetType(), "TxtBxOdaMesajlariId", "var m_TxtBxOdaMesajlariId = '" + TxtBxOdaMesajlari.ClientID + "'";, true);
and in javascript:
var textBox = $get(m_TxtBxOdaMesajlariId);

Show picture in 30 days ASP.NET

I am trying to make my first public .net website but I have a little problem.
It's a webshop, where i want to show at new product picture, if the product is not older than the current date with more than 30 days?
Markup:
<asp:Repeater ID="rptProducts" runat="server">
<ItemTemplate>
<table cellpadding="5" cellspacing="5" class="tblSales">
<tr>
<td>
<h3>
<asp:Label ID="Label1" Text='<%#Eval("ProductName")%>' runat="server" /></h3>
<h2>
<a href='<%# "Products.aspx?ID=" + Eval("ProductID") %>'>Read More</a></h2>
</td>
<td >
<h4>
<asp:Label ID="Label2" Text='<%#Eval("ProductPrice")%>' runat="server" />,-</h4>
<div>
<img alt="New product" src="images/NewProduct.png" /><!--This picture should show in 30 days-->
</div>
</td>
</tr>
<hr />
</table>
</ItemTemplate>
</asp:Repeater>
Code-behind:
public partial class sale : System.Web.UI.Page
{
ProductsTableAdapter p = new ProductsTableAdapter();
protected void Page_Load(object sender, EventArgs e)
{
GetData();
}
protected void GetData()
{
rptProducts = p.GetProductsByCategoryID(3);
rptProducts();
}
}
EDITED: As a user noted this may be a misinterpretation so...
IF you want to filter items that were added and not display them at all use the following LINQ expression on the GetData method:
rptProducts = p.GetProductsByCategoryID(3).Where(p=>p.ProductAddedDate > DateTime.Now.AddDays(-30));
you need to have a property (in the above example I added a DateTime ProductAddedDate to the product class
IF you want to not show the image based on the date BUT show everything else you could:
In the ItemDataBound event of the repeater you can set asp control (replace static html with asp:Image which allows you to control display using the Visible property i.e.
<asp:Repeater ID="rptProducts" runat="server" OnItemDataBound="rptProducts_Databound">
<ItemTemplate>
<table cellpadding="5" cellspacing="5" class="tblSales">
<tr>
<td>
<h3>
<asp:Label ID="Label1" Text='<%#Eval("ProductName")%>' runat="server" /></h3>
<h2>
<a href='<%# "Products.aspx?ID=" + Eval("ProductID") %>'>Read More</a></h2>
</td>
<td >
<h4>
<asp:Label ID="Label2" Text='<%#Eval("ProductPrice")%>' runat="server" />,-</h4>
<div>
<asp:Image ID="ProdImg" runat="server" AlternativeText="New product" ImageUrl='<%# "~/images/" + Eval("ImageFileName")' Visible="True"/><!--This picture should show in 30 days-->
</div>
</td>
</tr>
<hr />
</table>
</ItemTemplate>
</asp:Repeater>
CS codebehind
protected void rptProducts_Databound(object sender, RepeaterItemEventArgs e)
{
var imgCtrl = (Image)e.Item.FindControl("ProdImg");
var dataItem = (Product)e.Item.DataItem;
imCtrl.Visible = dataItem.ProductAddedDate > DateTime.Now.AddDays(-30);
}
Many thanks, I find out how to make it :)thanks to you, quite simple but i works.
here is the code I made:
<asp:Image ID="Image2" ImageUrl="~/images/new.png" Visible='<%#GetProductSalesPic(Eval("ProductDate"))%>' runat="server" />
C# code:
protected bool GetProductSalesPic(object Date)
{
DateTime actDate = (DateTime)Date;
if (DateTime.Now.AddDays(-30) < actDate)
{
return true;
}
else
{
return false;
}
}
And again, Thanks You, for the fast and good response :D

Categories