C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Offshore Development    
Silverlight Tutorials | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Blog article with calender control


Posted Date: 21 Aug 2008      Total Responses: 0

Posted By: saquib       Member Level: Bronze     Points: 1


Hi, i am using telerik rad ajax in vs 2005. i like the RadAjax for ASP.NET AJAX Blog example and i create a page to display my blog on that. everything is perfectly work but i use sql server not access Db, so i'm getting error on SELECT * from BooksDB WHERE dtEntered = ? that 'Incorrect syntax near ? and i have 45 blog posts in my database so i want to retrieve by date with this method, and with this coding i'll retrieve my blog by selected dates only.



Public Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As DayRenderEventArgs)
If e.Day.[Date] = DateTime.Parse("8/05/2008") OrElse e.Day.[Date] = DateTime.Parse("8/10/2008") OrElse e.Day.[Date] = DateTime.Parse("8/16/2008") Then
e.Cell.Attributes.Add("class", "CalendarDay")
Else
e.Cell.Controls.Clear()
e.Cell.Controls.Add(New LiteralControl(String.Format("<div>{0}</div>", e.Day.[Date].Day)))
End If
End Sub


but i have 4 month of data, so i want to retrieve records according to this. i also show u my code

<%@ Page Language="VB" MasterPageFile="~/home.master" AutoEventWireup="false" CodeFile="myBlog.aspx.vb" Inherits="myBlog" title="Untitled Page" %>

<%@ Register Assembly="DevExpress.Web.v7.3, Version=7.3.6.0, Culture=neutral, PublicKeyToken=49d90c14d24271b5"
Namespace="DevExpress.Web.ASPxDataView" TagPrefix="dxdv" %>

<%@ Register Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" TagPrefix="telerik" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<telerik:RadAjaxManager ID="RadAjaxManager1" runat="server">
<AjaxSettings>
<telerik:AjaxSetting AjaxControlID="Calendar1">
<UpdatedControls>
<telerik:AjaxUpdatedControl ControlID="BookGrid" LoadingPanelID="LoadingPanel1"></telerik:AjaxUpdatedControl>
<telerik:AjaxUpdatedControl ControlID="Calendar1"></telerik:AjaxUpdatedControl>
</UpdatedControls>
</telerik:AjaxSetting>
</AjaxSettings>
</telerik:RadAjaxManager>
<telerik:RadAjaxLoadingPanel ID="LoadingPanel1" runat="server" Height="75px"
Width="75px">
<img alt="Loading..." src='<%= RadAjaxLoadingPanel.GetWebResourceUrl(Page, "Telerik.Web.UI.Skins.Default.Ajax.loading.gif") %>'
style="border: 0px;" />
</telerik:RadAjaxLoadingPanel>
<div class="blogBorders">
<div class="blogContentWrapper">
<div class="header">
</div>
<div class="calendar">
<div class="calendarWrapper">
<asp:Calendar ID="Calendar1" runat="server" BorderStyle="None" CellPadding="0" CssClass="aspCalendar"
DayNameFormat="FirstLetter" VisibleDate="08/05/2008" CellSpacing="0" OnDayRender="Calendar1_DayRender"
OnSelectionChanged="Calendar1_SelectionChanged">
<DayHeaderStyle BackColor="White"></DayHeaderStyle>
<TitleStyle ForeColor="White" CssClass="title" BackColor="Transparent" Wrap="False">
</TitleStyle>
</asp:Calendar>
</div>
</div>
<div id="BlogPostPlaceHolder">
<dxdv:ASPxDataView ID="BookGrid" runat="server" DataSourceID="BookSource"
RowPerPage="4" AlwaysShowPager="True" ColumnCount="2">
<ItemTemplate>
<div style="height: 100px;"><asp:Image ID="Image1" Width="100" Height="100" Runat="Server"
AlternateText='<%# "Picture of " & Eval("image") %>'
ImageUrl='<%# "images/" & Eval("image") & ".jpg" %>' /></div>
<br /><br />
<div class="DataViewItemTitle"><asp:HyperLink ID="HyperLink2" Runat="server" Text='<%# DataBinder.Eval(Container.DataItem,"CategoryTitle") %>' NavigateUrl='<%# "Details.aspx?CategoryID=" & Container.DataItem("CategoryID") %>' /></div>
</ItemTemplate>
<PagerSettings SEOFriendly="Enabled">
<AllButton Visible="True">
</AllButton>
</PagerSettings>
<ItemStyle HorizontalAlign="Center">
<BackgroundImage HorizontalPosition="center" ImageUrl="~/images/diag_gris.gif" />
</ItemStyle>
<PagerStyle BackColor="#FF8080">
<BackgroundImage HorizontalPosition="center" />
</PagerStyle>
</dxdv:ASPxDataView>
</div>
</div>
</div>
<asp:SqlDataSource ID="BookSource" runat="server" ConnectionString="<%$ ConnectionStrings:SecurityTutorialsConnectionString %>" SelectCommand="select * from BooksDB WHERE dtEntered = @dtEntered">
<SelectParameters>
<asp:ControlParameter ControlID="Calendar1" DefaultValue="08/05/2008" Name="dtEntered"
PropertyName="SelectedDate" Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>
</asp:Content>





and vb code:
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If Not Page.IsPostBack Then
Calendar1.SelectedDate = DateTime.Parse("08/05/2008")
End If
End Sub

Public Sub Calendar1_DayRender(ByVal sender As Object, ByVal e As DayRenderEventArgs)
If e.Day.[Date] = DateTime.Parse("08/05/2008") OrElse e.Day.[Date] = DateTime.Parse("08/10/2008") OrElse e.Day.[Date] = DateTime.Parse("08/16/2008") Then
e.Cell.Attributes.Add("class", "CalendarDay")
Else
e.Cell.Controls.Clear()
e.Cell.Controls.Add(New LiteralControl(String.Format("<div>{0}</div>", e.Day.[Date].Day)))
End If
End Sub

Public Sub Calendar1_SelectionChanged(ByVal sender As Object, ByVal e As EventArgs)
System.Threading.Thread.Sleep(2000)
End Sub



i used the method that u specify but my devexpress dataview grid not display. if i type select * from booksdb. it display the the dataview but not work with calender control.


so please help me to solve this matter




Responses


No responses found. Be the first to respond and make money from revenue sharing program.

Post Reply
You must Sign In to post a response.
Next : how-to-make-a-personalized-startup-page-like-pageflakescom
Previous : Link redirection
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers   BizTalk Adaptors    Web Design

fax server

Contact Us    Privacy Policy    Terms Of Use