Proxy > Gmail Facebook Yahoo!

ToolkitScriptManager On MasterPage To Use AjaxControlToolkit Controls



How To Add ToolkitScriptManager On MasterPage To Use AjaxControlToolkit Controls On Content Pages In Asp.Net


Add ToolkitScriptManager On MasterPage In Asp.Net


When we use AjaxControlToolkit controls on content pages of site with master page, we get some errors becuase ScriptManager or ToolkitScriptManager not placed properly on master page.

One of such error is

"AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll."

This error occurs if you are using .NET framework 3.5 or avobe and have placed ScriptManager on the masterPage.

To fix this error remove ScriptManager and place ToolkitScriptManager on Master Page.


If you receive

"'ToolkitScriptManager' must be placed inside a form tag with runat=server" error

Or

The control with ID 'yourAjaxcontrolID' requires a ScriptManager on the page. The ScriptManager must appear before any controls that need it error.

Then either you have placed ToolkitScriptManager in head section of MasterPage or in ContentPlaceHolder.

ToolkitScriptManager must be placed within the form tag of MasterPage.
If you place ToolkitScriptManager on master page as mentioned above, YOu don't need to put any scriptmanagerproxy or ToolkitScriptManager on content pages.

HTML SOURCE OF MASTER PAGE WITH ToolkitScriptManager SHOULD LOOK LIKE SHOWN BELOW
   1:  <%@ Master Language="C#" AutoEventWireup="true" 
   2:  CodeFile="MasterPage.master.cs" Inherits="MasterPage" %>
   3:   
   4:  <%@ Register assembly="AjaxControlToolkit" 
   5:  namespace="AjaxControlToolkit" tagprefix="asp" %>
   6:   
   7:  <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" 
   8:  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
   9:   
  10:  <html xmlns="http://www.w3.org/1999/xhtml">
  11:  <head runat="server">
  12:  <link href="StyleSheet.css" rel="stylesheet" type="text/css" />
  13:  <title>Using AjaxControlToolkit With MasterPage</title>
  14:  <asp:ContentPlaceHolder id="head" runat="server"/>
  15:  </head>
  16:   
  17:  <body>
  18:  <form id="form1" runat="server">
  19:  <div>
  20:  <asp:ToolkitScriptManager ID="ToolkitScriptManager1" 
  21:                            runat="server">
  22:  </asp:ToolkitScriptManager>    
  23:   
  24:  <asp:ContentPlaceHolder id="ContentPlaceHolder1" 
  25:                          runat="server">
  26:  </asp:ContentPlaceHolder>
  27:  </div>
  28:  <p style="text-align: center">master page</p>
  29:  Place your master page contents here 
  30:  </form>
  31:  </body>
  32:  </html>

HTML SOURCE OF CONTENT PAGES WITH AJAX CONTROLS SHOULD LOOK LIKE MENTIONED BELOW
   1:  <%@ Page Title="" Language="C#" 
   2:  MasterPageFile="~/MasterPage.master" 
   3:  AutoEventWireup="true" CodeFile="Default2.aspx.cs" 
   4:  Inherits="Default2" %>
   5:   
   6:  <%@ Register Assembly="AjaxControlToolkit" 
   7:  Namespace="AjaxControlToolkit" TagPrefix="asp" %>
   8:   
   9:  <asp:Content ID="Content1" ContentPlaceHolderID="head" 
  10:               Runat="Server">
  11:  </asp:Content>
  12:   
  13:  <asp:Content ID="Content2" 
  14:               ContentPlaceHolderID="ContentPlaceHolder1" 
  15:               Runat="Server">
  16:   
  17:  <asp:TextBox ID="TextBox1" runat="server"/>
  18:  <asp:PasswordStrength ID="PasswordStrength1" 
  19:                        runat="server" 
  20:                        TargetControlID="TextBox1" 
  21:                        DisplayPosition="RightSide"
  22:                        StrengthIndicatorType="BarIndicator" 
  23:                        BarBorderCssClass="BarBorder"
  24:                        StrengthStyles="BarIndicatorweak;
  25:                        BarIndicatoraverage;BarIndicatorgood;">
  26:  </asp:PasswordStrength>
  27:   
  28:  </asp:Content>

Hope this helps
[Read More...]


Application to speak the text in the textbox using C#.Net



Design:

textspeaker1.JPG

Design the form as shown above with one TextBox and three Buttons, Set the 'textBox1' Properties as follows:

Dock: Top,

Multiline: True.

Now goto 'Project' Menu -> Select 'AddReference'-> Click on 'COM' tab.

Select 'Microsoft Speech Object Library' COM component -> OK

textspeaker2.JPG

Now goto code window and include 'using SpeechLib' namespace

Code: 


using
System;
using
System.Windows.Forms;
using
SpeechLib;//include this namespace
 namespace TextSpeaker
{
   public partialclass TextSpeakerForm : Form
    {
       public TextSpeakerForm()
        {
            InitializeComponent();
        }
       private void btnSpeak_Click(object sender,EventArgs e)
        {
           if (textBox1.Text.Trim().Length > 0)
            {
               SpVoice obj = newSpVoice();
                obj.Speak(textBox1.Text, SpeechVoiceSpeakFlags.SVSFDefault);
            }
           MessageBox.Show("Plz. write some text in the TextBox","Info.",MessageBoxButtons.OK,MessageBoxIcon.Information);
        }
       private void btnClear_Click(object sender,EventArgs e)
        {
            textBox1.Text = "";
        }
       private void btnExit_Click(object sender,EventArgs e)
        {
           this.Close();
        }
    }
}


Output:

Write some text in the textbox and press 'speak' button

textspeaker3.JPG
[Read More...]


Ajax Asp.Net PasswordStrength Example | My Code Logic



[Read More...]


Ajax Asp.Net PasswordStrength Example



Passwordstrength ajax asp.net
PasswordStrength Example using Ajax In Asp.Net.

In this example i'm explaining how to use PasswordStrength Control of AjaxControlToolkit for asp.net 3.5.

For this Add latest version of AjaxControlToolkit.dll in BIN folder of application and place one textbox and passwordstrength control on the aspx page.

Add below mentioned CSS style in stylesheet.css for strength bar to show up.



CSS StyleSheet

.BarIndicatorweak
{
    color:Red;
    background-color:Red;
}
.BarIndicatoraverage
{
    color:Blue;
    background-color:Blue;
}
.BarIndicatorgood
{
    color:Green;
    background-color:Green;
}

.BarBorder
{
    border-style:solid;
    border-width:1px;
    padding:2px 2px 2px 2px;
    width:200px;
    vertical-align:middle;
}
Now configure the passwordstrength control as shown below.

<form id="form1" runat="server">
<div>
<asp:ToolkitScriptManager ID="ToolkitScriptManager1" 
                          runat="server">
</asp:ToolkitScriptManager>

<asp:TextBox ID="TextBox1" runat="server" 
             TextMode="Password">
</asp:TextBox>
        <br />
<asp:PasswordStrength ID="PasswordStrength1" 
                      runat="server" 
         TargetControlID="TextBox1" 
         RequiresUpperAndLowerCaseCharacters="true"
         MinimumNumericCharacters="1" 
         MinimumSymbolCharacters="1" 
         MinimumUpperCaseCharacters="1" 
         PreferredPasswordLength="8"
         DisplayPosition="RightSide" 
         StrengthIndicatorType="Text">
</asp:PasswordStrength>
        <br />
        <br />
<asp:TextBox ID="TextBox2" runat="server" 
             TextMode="Password">
</asp:TextBox>
<asp:PasswordStrength ID="PasswordStrength2" 
                      runat="server" 
        TargetControlID="TextBox2" 
        RequiresUpperAndLowerCaseCharacters="true"
        MinimumNumericCharacters="1" 
        MinimumSymbolCharacters="1" 
        MinimumUpperCaseCharacters="1" 
        PreferredPasswordLength="8"
        DisplayPosition="RightSide" 
        StrengthIndicatorType="BarIndicator" 
        BarBorderCssClass="BarBorder" 
StrengthStyles="BarIndicatorweak;BarIndicatoraverage;BarIndicatorgood;">
</asp:PasswordStrength>
    </div>
    </form>

Build and run the application.
[Read More...]


Add License Agreement In Visual Studio Setup Project



Add License agreement in setup project
Add License Agreement In Setup Project using Visual Studio

In this post i am explaining steps to add license agreement dialog in visual studio setup project.

Read Create Setup And Deployment Project in Visual Studio 2008/2010 to know how to create setup for your winforms or asp.net applications.









step 1.

First of all we need to create a licence agreement file, for this open wordpad and type your licence agreement text and save it as licence.rtf.

Add this file in your project in solution explorer by select add existing item menu.


Step 2.

Right click on your setup project and select View > File System.

license agreement in visual studio setupproject

Step 3.

Right click on Application folder and select Add > File.

Browse to licence.rtf we added to solution in step 1.

Add license.rtf file

Step 4.

Right click on setup project in solution explorer and select View > User Interface.

UserInterface in setupproject

Step 5.

Right click on Start and select Add Dialog.

Add dialog in setup project

Select Licence agreement and click on OK.

License agreement dialog in setup project

Move it Up by right clicking and selecting Move Up to put it on the top to show up when setup starts.

Step 6.

Select Licence Agreement dialog in start group and open it's property window by pressing F4 key.



Click on Browse in LicenceFile property and select licence.rtf file from Application Folder and click on OK.

add licence.rtf to license agreement dialog

Save and build the setup project and licence agreement dialog will launch when you run setup.exe (as shown below).

[Read More...]



Send mail to your Friends.  

Expert Feed

 
Return to top of page Copyright © 2011 | My Code Logic Designed by Suneel Kumar