ASP.net AJAX Text Editor

clock November 16, 2007 05:27 by author Nazar Rizvi

I have been using the FCK Text Editor for almost 2 years, and finally codeplex have come out with a new ASP.NET AJAX Rich Text Editor.

Featurewise it has all the funtionality of FCKeditor; I think tha performance it not upto the previous one, but who cares the AJAX makes it all the more usable.

And it also supports multiple languages. Here is the code plex link.

Currently rated 4.0 by 8 people

  • Currently 4/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Image Slideshow with fading effect

clock November 11, 2007 08:05 by author Nazar Rizvi

I have been trying to use the slideshow control so that the images fade in and fade out. I tried searching various forums out there but there is no actual solution for it. Undecided 

Finally I added up few AJAX animation effects to the slideshow container which would give you the desired effect.

NOTE: This is sort of an hack where in you have to manually time the fading in and out effects and the slideshow timing.

Also since this is continuous javascript this might put a little bit load on the user's browser.

Below is my code:

<script runat="Server" type="text/C#">

[System.Web.Services.WebMethod]

[System.Web.Script.Services.ScriptMethod]

public static AjaxControlToolkit.Slide[] GetSlides()

{

return new AjaxControlToolkit.Slide[] {

new AjaxControlToolkit.Slide("images/Autumn Leaves.jpg", "", ""),

new AjaxControlToolkit.Slide("images/Creek.jpg", "", ""),

new AjaxControlToolkit.Slide("images/Dock.jpg", "", ""),

new AjaxControlToolkit.Slide("images/Forest.jpg", "", "")};

}

</script>

<div>

<asp:Image ID="Image1" runat="server" Width="800px" Style="border: 1px solid black;

width: auto" ImageUrl="images/Creek.jpg" AlternateText="ME" /><br />

</div>

<cc1:SlideShowExtender ID="slideshowextend1" runat="server" TargetControlID="Image1"

SlideShowServiceMethod="GetSlides" AutoPlay="true" ImageTitleLabelID="imageTitle"

ImageDescriptionLabelID="imageDescription" PlayInterval="7000" Loop="true" />

<cc1:AnimationExtender ID="MyExtender" runat="server" TargetControlID="Image1">

<Animations>

<OnLoad>

<Sequence iterations="0">

<FadeIn Duration="10.0" Fps="5" />

<FadeOut Duration="10.0" Fps="5" />

</Sequence>

</OnLoad>

</Animations>

</cc1:AnimationExtender>

Currently rated 4.7 by 6 people

  • Currently 4.666667/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Two rows of tab headers in TabContainer in Ajax Control Toolkit

clock October 9, 2007 21:27 by author Nazar Rizvi

I had this issue where I wanted more than one row of headers in the TabContainer as I had a large number of panels and was not able to fit them in the page.

Here is the solution. [make sure you download the toolkit with source]

Open the AJAX Control Toolkit's solution by clicking on the solution file inside the toolkit folder.  

Open the file Tabs.css under AjaxControlToolkit/Tabs/Tabs.css

And make the following changes.

/* default layout */.ajax__tab_default .ajax__tab_header {}
.ajax__tab_default .ajax__tab_outer {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_inner {display:-moz-inline-box;display:inline-block}
.ajax__tab_default .ajax__tab_tab {margin-right:4px;overflow:hidden;text-align:center;cursor:pointer;display:-moz-inline-box;display:inline-block}

Now click on Build -> Build Solution to build the solution.


Use the AjaxControlToolkit.dll under ToolkitTests/Bin folder as your reference from now on.


Add this dll file as reference to your current website and you should have the 2 rows.


 

 

Currently rated 4.5 by 11 people

  • Currently 4.454546/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Special GridView

clock October 7, 2007 01:28 by author Nazar Rizvi

I have been going through the ASP.net forums and many people have had issues with GridViews especially the situation where the user wants to group each row by a particular condition.

There are controls available in the market which solve the issue (only sad part is we need to buy them).

I have used up 2 GridViews and AJAX Control Toolkit's accordion to achieve the required result. I have not done any back-end code, so this enables even a novice developer to create this page. Also I am using the NorthWind database provided by Microsoft.

 

Working Link

Download the source-code

Screenshot:

Code:

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="CategoryID"                
DataSourceID="getCategories">                
<Columns>                    
<asp:TemplateField HeaderText="CategoryName" SortExpression="CategoryName">                        
<ItemTemplate>                            
<asp:Label Visible="false" ID="labelCategoryID" runat="server" Text='<%# Bind("CategoryID") %>'></asp:Label>                           
<cc1:Accordion ID="MyAccordion" runat="server" SelectedIndex="-1" HeaderCssClass="accordionHeader"                                
ContentCssClass="accordionContent" FadeTransitions="true" FramesPerSecond="30"                                
TransitionDuration="250" Width="500px" AutoSize="None" RequireOpenedPane="false"                                
SuppressHeaderPostbacks="true">                                
<Panes>                                    
<cc1:AccordionPane ID="pane1" runat="server">                                        
<Header>                                            
<asp:DataList ID="DataList2" runat="server" DataSourceID="getNamefromID">                                                
<ItemTemplate>                                                    
<asp:HyperLink NavigateUrl="~/Default.aspx" runat="server" Text='<%# Eval("CategoryName") %>'></asp:HyperLink>                                                
</ItemTemplate>                                           
</asp:DataList>                                        
</Header>                                        
<Content>                                            
<asp:GridView CellPadding="4" ForeColor="#333333" GridLines="None" ID="GridView2"                                                
runat="server" AutoGenerateColumns="False" DataKeyNames="ProductID" DataSourceID="getProducts">                                                
<FooterStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />                                                
<RowStyle BackColor="#E3EAEB" />                                                
<PagerStyle BackColor="#666666" ForeColor="White" HorizontalAlign="Center" />                                                
<SelectedRowStyle BackColor="#C5BBAF" Font-Bold="True" ForeColor="#333333" />                                                
<HeaderStyle BackColor="#1C5E55" Font-Bold="True" ForeColor="White" />                                                
<EditRowStyle BackColor="#7C6F57" />                                                
<AlternatingRowStyle BackColor="White" />                                                
<Columns>                                                    
<asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"                                                        
ReadOnly="True" SortExpression="ProductID" />                                                    
<asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />                                                    
<asp:BoundField DataField="SupplierID" HeaderText="SupplierID" SortExpression="SupplierID" />                                                    
<asp:BoundField DataField="QuantityPerUnit" HeaderText="QuantityPerUnit" SortExpression="QuantityPerUnit" />                                                
</Columns>                                            
</asp:GridView>                                        
</Content>                                    
</cc1:AccordionPane>                                
</Panes>                            
</cc1:Accordion>                            
<asp:AccessDataSource ID="getNamefromID" runat="server" DataFile="~/App_Data/Nwind.mdb"                                
SelectCommand="SELECT [CategoryName],[CategoryID] FROM [Categories] WHERE ([CategoryID] = ?)">                                
<SelectParameters>                                    
<asp:ControlParameter ControlID="labelCategoryID" Name="CategoryID" PropertyName="Text"                                       
 Type="Int32" />                                
</SelectParameters>                            
</asp:AccessDataSource>                            
<asp:AccessDataSource ID="getProducts" runat="server" DataFile="~/App_Data/Nwind.mdb"                                
SelectCommand="SELECT [ProductID], [ProductName], [SupplierID], [QuantityPerUnit] FROM [Products] WHERE ([CategoryID] = ?)">                                
<SelectParameters>                                    
<asp:ControlParameter ControlID="labelCategoryID" Name="CategoryID" PropertyName="Text"                                        
Type="Int32" />                                
</SelectParameters>                            
</asp:AccessDataSource>                        
</ItemTemplate>                    
</asp:TemplateField>                
</Columns>            
</asp:GridView>            
<asp:AccessDataSource ID="getCategories" runat="server" DataFile="~/App_Data/Nwind.mdb"                
SelectCommand="SELECT [CategoryName], [CategoryID] FROM [Categories]"></asp:AccessDataSource>

 

Currently rated 5.0 by 7 people

  • Currently 5/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Dictionary words populated to your TextBox (similar to Google labs)

clock October 3, 2007 21:25 by author Nazar Rizvi

1. Now for this one I got hold of one of the dictionary files from a dictionary attack and converted into an access DB.

2. Then went ahead and built an AJAX enabled website using VS 2005.

3. Added up a TextBox and an AutoCompleteExtender.

4. Add an AutoComplete page method from the tasks.

Code of the .aspx page:

<form id="form1" runat="server">        
<asp:ScriptManager ID="ScriptManager1" runat="server" />        
<div>            
Automatically generating words for a textbox using asp.net ajax:
<br />            
<br />            
<asp:TextBox ID="TextBox1" runat="server" Width="372px"></asp:TextBox><br />            
<br />            
<cc1:AutoCompleteExtender TargetControlID="TextBox1" MinimumPrefixLength="1" ID="AutoCompleteExtender1" runat="server" ServiceMethod="GetCompletionList"                
UseContextKey="True">            
</cc1:AutoCompleteExtender>        
</div>    
</form>


4. Added up the following code in the .cs file where in I am doing a simple query and calling up the web service method.

public static string[] GetCompletionList(string prefixText, int count, string contextKey)
{
if (count == 0){count = 10;}string connString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source='C:\\Users\\abbas\\Desktop\\site1\\App_Data\\db01.mdb'";
OleDbConnection conn = new OleDbConnection(connString);string sql = "SELECT [Desc]FROM Table1 WHERE Desc LIKE (@value + '%')";
OleDbCommand myCmd = new OleDbCommand(sql, conn);
myCmd.Parameters.Add(new OleDbParameter("@value", System.Data.SqlDbType.Text));
conn.Open();myCmd.Parameters["@value"].Value = prefixText.ToString();
OleDbDataReader reader = myCmd.ExecuteReader();int i = 0;
ArrayList arrNames = new ArrayList();while (reader.Read() && i < 20){arrNames.Add(reader[0].ToString());i++;
}
conn.Close();
return (string[])(arrNames.ToArray(connString.GetType()));}


And here it goes. I just kept the number of results to 20.





(for the DB. Download a dictionary wordlist. Create a Db with one table and import the data. There you go. If you need the DB or the wordlist just email me)

 

Currently rated 4.7 by 3 people

  • Currently 4.666667/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Image Display: ASP.net AJAX

clock October 3, 2007 18:22 by author Nazar Rizvi

If you have an image search built in your application and want to have a display similar to that of the live image search you can follow this procedure.

Use a DataList to display your search results and make use of the HoverMenuExtender (one of the new controls from the AJAXcontrolToolkit. You can Change the CSS style to obtain your desired look.

Here is the sample code.


The result of this code:

Currently rated 3.3 by 3 people

  • Currently 3.333333/5 Stars.
  • 1
  • 2
  • 3
  • 4
  • 5


Search

Calendar

<<  March 2010  >>
SuMoTuWeThFrSa
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910

Archive

Tags

    Categories


    Disclaimer

    The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

    © Copyright 2010

    Sign in