Quantcast
Channel: ASP.NET AJAX + Ajax Control Toolkit (ACT)
Viewing all 5678 articles
Browse latest View live

DevExpress maintains the free and open sourced Ajax Control Toolkit

$
0
0

DevExpress has stepped up and offered to lead this open source project. In just a few short months, they have implemented a number of modern and strategic changes to the toolkit to help make it a valuable part of your ASP.NET Web Forms arsenal. This release is branded as version 15.1 and is available NOW from http://devexpress.com/ms-act

DevExpress has written a great post highlighting the updates they've made to the toolkit on their blog at https://community.devexpress.com/blogs/aspnet/archive/2015/03/10/announcing-the-asp-net-ajax-control-toolkit-v15-1.aspx   


AjaxControl Toolkit 15.1 - Update Panel Child Triggers Stopped Working

$
0
0

I just updated to AjaxControl Toolkit 15.1 and my UpdatePanel Child Triggers stopped working. Nothing was changed on the page. The code is exactly the same. If I move a button outside of the Update Panel or simply remove the Update Panel everything works, but not smoothly. However, all of the buttons or triggers inside the update panels do not work. What could be the issue with this new Toolkit? 

A Tab Panel is inside the Update Panel too.

UPDATE: I removed the tabs and the update panels and triggers work.

<asp:Button ID="Button3" runat="server" Text="-" OnClick="DecreasePoemTextButton1_Click" CommandArgument="Smaller" />
 protected void DecreasePoemTextButton1_Click(object sender, EventArgs e)
    {
        if (LabelPoemText.Font.Size == 22) { LabelPoemText.Font.Size = 20; }
        else if (LabelPoemText.Font.Size == 20) { LabelPoemText.Font.Size = 18; }
        else if (LabelPoemText.Font.Size == 18) { LabelPoemText.Font.Size = 16; }
        else if (LabelPoemText.Font.Size == 16) { LabelPoemText.Font.Size = 14; }
        else if (LabelPoemText.Font.Size == 14) { LabelPoemText.Font.Size = 12; }
        else if (LabelPoemText.Font.Size == 12) { LabelPoemText.Font.Size = 10; }
        else if (LabelPoemText.Font.Size == 10) { LabelPoemText.Font.Size = 8; }
        else if (LabelPoemText.Font.Size == 8) { LabelPoemText.Font.Size = 6; }
    }
    protected void Heading1_TextChanged(object sender, EventArgs e)
    {
        LabelPoemTitle.ForeColor = System.Drawing.ColorTranslator.FromHtml("#" + HeadingColor1.Text);
        HeadingColor1.ForeColor = System.Drawing.ColorTranslator.FromHtml("#" + HeadingColor1.Text);
        HeadingColor1.BackColor = System.Drawing.ColorTranslator.FromHtml("#" + HeadingColor1.Text);
    }
<asp:UpdatePanel ID="UpdatePanel2" runat="server" ChildrenAsTriggers="true"><ContentTemplate><div class="column1"> <ajaxToolkit:TabContainer ID="TabContainer1" runat="server" ActiveTabIndex="1" Width="100%" CssClass="MyTabStyle"><ajaxToolkit:TabPanel ID="TabPanel1" runat="server" HeaderText="Enter Poem or Quote"><HeaderTemplate>
                            Enter Text</HeaderTemplate><ContentTemplate><asp:Button ID="Button7" runat="server" Text="Update Text" OnClick="Button6_Click" ValidationGroup="poem" /><p><b>Enter Title (Not Required)</b><br /><asp:TextBox ID="TextBox_PoemTitle" runat="server" Width="400px"></asp:TextBox></p><p><b>Enter Poem or Quote <span style="color: #006600">(Required)<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox_Poem" Display="Dynamic" ErrorMessage="Required" Font-Bold="True" ForeColor="#CC0000" SetFocusOnError="True" ValidationGroup="poem"></asp:RequiredFieldValidator></span></b><br /><asp:TextBox ID="TextBox_Poem" runat="server" TextMode="MultiLine" Height="300px" Width="400px" ValidationGroup="poem"></asp:TextBox></p><p><b>Enter Author Name (Not Required)</b><br /><asp:TextBox ID="TextBox_Author" runat="server" Width="400px"></asp:TextBox></p><asp:Button ID="Button6" runat="server" Text="Update Text" OnClick="Button6_Click" ValidationGroup="poem" /></ContentTemplate></ajaxToolkit:TabPanel><ajaxToolkit:TabPanel ID="TabPanel2" runat="server" HeaderText="Edit Text Attributes"><HeaderTemplate>
                            Change Text Layout, etc.</HeaderTemplate><ContentTemplate><div id="tabs-1" style="line-height: 250%"><strong>Move Text:</strong><asp:Button ID="MoveDown" runat="server" OnClick="MoveDown_Click" Text="Down" /><asp:Button ID="MoveUp" runat="server" OnClick="MoveUp_Click" Text="Up" /><h3>Heading Text</h3><asp:Button Text="B" runat="server" OnClick="btnBoldHeading_Click" ID="btnBold"></asp:Button><asp:Button Text="I" ID="btnItalic" OnClick="btnItalicHeading_Click" runat="server"></asp:Button><asp:Button ID="DecreaseHeading" runat="server" Text="-" OnClick="DecreaseHeadingButton1_Click" CommandArgument="Smaller" /><asp:Button ID="IncreaseHeading" runat="server" Text="+" OnClick="IncreaseHeadingButton1_Click" CommandArgument="Bigger" />&nbsp;<asp:ImageButton ID="ImageButton_AlignLeft" runat="server" Height="16px" ImageUrl="~/images/align_left.gif" Width="16px" OnClick="ImageButton_AlignLeftHeading_Click" />&nbsp;<asp:ImageButton ID="ImageButton_AlignCenter" runat="server" Height="16px" ImageUrl="~/images/align_center.gif" Width="16px" OnClick="ImageButton_AlignCenterHeading_Click" />&nbsp;<asp:ImageButton ID="ImageButton_AlignRight" runat="server" Height="16px" ImageUrl="~/images/align_right.gif" Width="16px" OnClick="ImageButton_AlignRightHeading_Click" />&nbsp;Color:<asp:TextBox runat="server" ID="HeadingColor1" MaxLength="6" OnTextChanged="Heading1_TextChanged" Width="20px" AutoPostBack="True" BackColor="White" /><asp:ImageButton runat="server" ID="HeadingImage1" Style="margin: 0 3px" ImageUrl="~/images/cp_button.png" AlternateText="Click to show color picker" /><asp:Button ID="HeadingRefresh1" runat="server" Text="update" /><br /><ajaxToolkit:ColorPickerExtender ID="defaultCPE" runat="server" OnClientColorSelectionChanged="colorChanged" TargetControlID="HeadingColor1" PopupButtonID="HeadingImage1" Enabled="True" /><asp:DropDownList runat="server" ID="ddlHeadingFonts" OnSelectedIndexChanged="ddlHeadingFonts_SelectedIndexChanged" AutoPostBack="True"><asp:ListItem Value="Arial, Helvetica, sans-serif">Arial</asp:ListItem><asp:ListItem Value="Arial Black, Gadget, sans-serif">Arial Black</asp:ListItem><asp:ListItem Value="Comic Sans MS, cursive, sans-serif">Comic Sans MS</asp:ListItem><asp:ListItem Value="Impact, Charcoal, sans-serif">Impact</asp:ListItem><asp:ListItem Value="Lucida Sans Unicode, Lucida Grande, sans-serif">Lucida Sans Unicode</asp:ListItem><asp:ListItem Value="Tahoma, Geneva, sans-serif">Tahoma</asp:ListItem><asp:ListItem Value="Trebuchet MS, Helvetica, sans-serif">Trebuchet MS</asp:ListItem><asp:ListItem Value="Verdana, Geneva, sans-serif">Verdana</asp:ListItem></asp:DropDownList><hr /><h3>Main/Poem Text</h3><asp:Button Text="B" runat="server" OnClick="btnBoldPoem_Click" ID="btnBold_Poem"></asp:Button><asp:Button Text="I" ID="btnItalicPoem" OnClick="btnItalicPoem_Click" runat="server"></asp:Button><asp:Button ID="Button3" runat="server" Text="-" OnClick="DecreasePoemTextButton1_Click" CommandArgument="Smaller" /><asp:Button ID="Button2" runat="server" CommandArgument="Bigger" OnClick="IncreasePoemTextButton1_Click" Text="+" />&nbsp;<asp:ImageButton ID="ImageButton2" runat="server" Height="16px" ImageUrl="~/images/align_left.gif" Width="16px" OnClick="ImageButton_AlignLeftPoem_Click" />&nbsp;<asp:ImageButton ID="ImageButton3" runat="server" Height="16px" ImageUrl="~/images/align_center.gif" Width="16px" OnClick="ImageButton_AlignCenterPoem_Click" />&nbsp;<asp:ImageButton ID="ImageButton4" runat="server" Height="16px" ImageUrl="~/images/align_right.gif" Width="16px" OnClick="ImageButton_AlignRightPoem_Click" />&nbsp;Color:<asp:TextBox runat="server" ID="PoemColor1" MaxLength="6" OnTextChanged="Poem1_TextChanged" Width="20px" AutoPostBack="True" BackColor="White" /><asp:ImageButton runat="server" ID="PoemImage1" Style="margin: 0 3px" ImageUrl="~/images/cp_button.png" AlternateText="Click to show color picker" /><asp:Button ID="Button5" runat="server" Text="update" /><br /><ajaxToolkit:ColorPickerExtender ID="ColorPickerExtender1" runat="server" OnClientColorSelectionChanged="colorChanged" TargetControlID="PoemColor1" PopupButtonID="PoemImage1" Enabled="True" /><asp:DropDownList runat="server" ID="ddlPoemFonts" OnSelectedIndexChanged="ddlPoemFonts_SelectedIndexChanged" AutoPostBack="True"><asp:ListItem Value="Arial, Helvetica, sans-serif">Arial</asp:ListItem><asp:ListItem Value="Arial Black, Gadget, sans-serif">Arial Black</asp:ListItem><asp:ListItem Value="Comic Sans MS, cursive, sans-serif">Comic Sans MS</asp:ListItem><asp:ListItem Value="Impact, Charcoal, sans-serif">Impact</asp:ListItem><asp:ListItem Value="Lucida Sans Unicode, Lucida Grande, sans-serif">Lucida Sans Unicode</asp:ListItem><asp:ListItem Value="Tahoma, Geneva, sans-serif">Tahoma</asp:ListItem><asp:ListItem Value="Trebuchet MS, Helvetica, sans-serif">Trebuchet MS</asp:ListItem><asp:ListItem Value="Verdana, Geneva, sans-serif">Verdana</asp:ListItem></asp:DropDownList></div></ContentTemplate></ajaxToolkit:TabPanel>


Ajax HTML Editor Height property not working

$
0
0

Hi,

I am using AJAX HTML editor, i have set the Height property but it does not work. Editor always keep the same size does not matter what height i set.

<cc1:Editor ID="txtPolicy" runat="server" Hight="800px" Width="90%"/>

MultiHandleSliderExtender not working in master child page

$
0
0

hello every i am working with MultiHandleSliderExtender for bind price range .

when i coded for simple page (without aattached master page ) working fine but when i using in master child page then it is not working .

please suggest me anyone 

my code is 

<%@ Page Title="" Language="C#" MasterPageFile="~/MasterPage.master" AutoEventWireup="true" CodeFile="Default4.aspx.cs" Inherits="Default4" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server"><title></title><style type="text/css">
        body
        {
            font-family: Arial;
            font-size: 10pt;
            margin: 0;
            padding: 0;
        }
        .loader
        {
            height: 50px;
            width: 100px;
        }
        .item
        {
            width: 202px;
            border: 1px solid #ccc;
            box-shadow: 2px 2px 8px 2px #ccc;
        }
        .item .header
        {
            height: 30px;
            background-color: #9F9F9F;
            color: #fff;
        }
        .item .body
        {
            width: 200px;
            height: 200px;
        }
        .item .image
        {
            height: 200px;
            width: 200px;
        }
        .item .footer
        {
            height: 50px;
        }
        .button, .button:hover
        {
            height: 45px;
            padding: 10px;
            color: White;
            line-height: 23px;
            text-align: center;
            font-weight: bold;
            cursor: pointer;
            border-radius: 4px;
            text-decoration: none;
            background-color: #9F9F9F;
            border: 1px solid #5C5C5C;
        }
        #price_slider, #price_slider_value
        {
            width: 400px;
            margin: 5px;
        }
        #empty
        {
            display: block;
            width: 400px;
            background-color: #9F9F9F;
            color: #fff;
            height: 30px;
            line-height: 30px;
            margin: 5px;
            text-align: center;
        }
        .modal
        {
            position: fixed;
            z-index: 999;
            height: 100%;
            width: 100%;
            top: 0;
            background-color: Black;
            filter: alpha(opacity=60);
            opacity: 0.6;
            -moz-opacity: 0.8;
        }
        .center
        {
            z-index: 1000;
            margin: 300px auto;
            padding: 10px;
            width: 130px;
            background-color: White;
            border-radius: 10px;
            filter: alpha(opacity=100);
            opacity: 1;
            -moz-opacity: 1;
        }
        .center img
        {
            height: 128px;
            width: 128px;
        }</style><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"   EnablePartialRendering="true"></asp:ToolkitScriptManager><asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"><ProgressTemplate><div class="modal"><div class="center"><img alt="" src="loader.gif" /></div></div></ProgressTemplate></asp:UpdateProgress><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:MultiHandleSliderExtender ID="MultiHandleSliderExtender1" runat="server" TargetControlID="txtSlider"
                Minimum="1" Maximum="1000" Increment="1" RaiseChangeOnlyOnMouseUp="true" EnableRailClick="false"
                OnClientDragEnd="OnClientDragEnd"><MultiHandleSliderTargets><asp:MultiHandleSliderTarget ControlID="hfStart" /><asp:MultiHandleSliderTarget ControlID="hfEnd" /></MultiHandleSliderTargets></asp:MultiHandleSliderExtender><asp:HiddenField ID="hfStart" runat="server" /><asp:HiddenField ID="hfEnd" runat="server" /><asp:TextBox ID="txtSlider" runat="server"></asp:TextBox><asp:LinkButton ID="lnkSliderChanged" OnClick="SliderChanged" runat="server" /><script type="text/javascript">
                function OnClientDragEnd(sender, args) {
                    document.getElementById("<%=lnkSliderChanged.ClientID %>").click();
                }</script><br /><hr /><asp:DataList ID="dlProducts" runat="server" RepeatLayout="Table" RepeatColumns="3"
                CellPadding="2" CellSpacing="20"><ItemTemplate><table class="item" cellpadding="0" cellspacing="0" border="0"><tr><td align="center" class="header"><span class="name"><%# Eval("Name") %></span></td></tr><tr><td align="center" class="body"><asp:Image ImageUrl='<%# Eval("ProductId", "~/images/{0}.png")%>' runat="server"
                                    CssClass="image" /></td></tr><tr><td class="footer" align="center"><span class="button"><%# Eval("Price") %></span></td></tr></table></ItemTemplate></asp:DataList></ContentTemplate></asp:UpdatePanel></asp:Content>

c # code 

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
public partial class Default4 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (!this.IsPostBack)
{
this.BindDataList();
}

}
protected void SliderChanged(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);
this.BindDataList();
}

private void BindDataList()
{
string constr = ConfigurationManager.ConnectionStrings["ErpConnection1"].ConnectionString;
int start = !string.IsNullOrEmpty(Request.Form[hfStart.UniqueID]) ? int.Parse(Request.Form[hfStart.UniqueID]) : 0;
int end = !string.IsNullOrEmpty(Request.Form[hfEnd.UniqueID]) ? int.Parse(Request.Form[hfEnd.UniqueID]) : 0;
using (SqlConnection con = new SqlConnection(constr))
{
string query = "SELECT * FROM Products WHERE (Price BETWEEN @Start AND @End) OR (@Start = 0 AND @End = 0);";
query += "SELECT MIN(Price) [Min], MAX(Price) [Max] FROM Products";
using (SqlCommand cmd = new SqlCommand(query))
{
cmd.Connection = con;
cmd.Parameters.AddWithValue("@Start", start);
cmd.Parameters.AddWithValue("@End", end);
using (SqlDataAdapter sda = new SqlDataAdapter(cmd))
{
DataSet ds = new DataSet();
sda.Fill(ds);
dlProducts.DataSource = ds.Tables[0];
dlProducts.DataBind();
if (!this.IsPostBack)
{
hfStart.Value = ds.Tables[1].Rows[0]["Min"].ToString();
hfEnd.Value = ds.Tables[1].Rows[0]["Max"].ToString();
}
}
}
}
}
}

 

AjaxFileUpload UploadCompleteAll not firing

$
0
0

This is weird.

I'm using the AjaxFileUpload to upload customer pictures about their place of business to our site so that we can show them to perspective clients for those businesses.  We allow up to 5 pictures.  The AjaxFileUpload control is inside a div1 to begin with. If the user uploads 2 pictures for example then the AjaxFileUpload controls is moved to div3 and then the maximum number of files is set to 3.  Everything works great as long as I don't try to upload a 5th file.  Doesn't matter if it is a single file that will be the 5th picture or 5 files at a time because there were no pictures to begin with or any other combination as long as it is not the last file.

So you might think that there is something in the 5th div that causes the problem. There is no difference in the asp or html controls (except for the id's).  Even if I change the maximum number to 4 then it is the 4th file that has the issue, in the 4th div, even though no asp or html controls have been changed.  As long as the last file is not uploaded both the server side and the client side UploadCompleteAll fires just fine.

Also in all cases the UploadComplete even fires perfectly and I can get the file and process it.

I don't understand at all what to even try to either debug or how to work around the problem.

Any help greatly appreciated.

TextBox Mask

$
0
0

I have a txtbox for phone that is masked for a phone number. I want to make it so that you have to enter all 10 numbers of the phone.

<asp:TextBox ID="txtphn" runat="server" Width="130px" AutoComplete="off" CssClass="txtInfoBox"></asp:TextBox><asp:MaskedEditExtender runat="server" ID="meephn" Mask="(999) 999-9999" TargetControlID="txtphn"
                    ClearMaskOnLostFocus="False"></asp:MaskedEditExtender>

Codebehinde inside ascx files are never executed

$
0
0

Environment: Visual Studio 2013 - VB.net - .Net Framework 4

Hi All,

I´m writting an intranet website that have some web applications.

These applications use customized panels that are in ascx files to show informations and make questions to the users.

These panels are used with modal popupextender.

All panels that only show informations are working well. but the panels that have codebehinde are not.

The code behinde linked to the buttons in panels inside ascx files are never executed.

See a sample:

ASCX File

<%@ Control Language="vb" AutoEventWireup="false" CodeBehind="Biblioteca.ascx.vb" Inherits="InformacoesCorporativas2013.Biblioteca" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><script runat="server">
    Protected Sub cmdOk_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        Session("Confirm_Delection") = "1"        
    End Sub

    Protected Sub cmdCancel_Click(sender As Object, e As System.EventArgs)
        
        Session("Confirm_Delection") = "0"        

    End Sub

</script><asp:panel id="Panel_Msgbox_Delecao" style="display:none" runat="server"><div class="Div_Painel_MSGBOX"><div id="PopupHeader" class="Div_Painel_MSGBOX_Cabecalho"><% Response.Write(InformacoesCorporativas2013.ClassesGlobais.wNomeSistema)%></div><div class="Div_Painel_MSGBOX_Corpo"><br /><br />
            Confirma deleção deste Registro ?
            <br /><br />&nbsp;</div><div class="Div_Painel_MSGBOX_Botoes"><asp:Button ID="cmdOk" runat="server" Text="Sim" OnClick="cmdOk_Click" /><asp:Button ID="cmdCancel" runat="server" Text="Não"  OnClick="cmdCancel_Click"/></div></div></asp:panel>

Aspx file

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/Principal.Master" CodeBehind="Default.aspx.vb" Inherits="InformacoesCorporativas2013._Default" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %><%@ Register Tagprefix="gm" Tagname="general_messages" Src="Biblioteca.ascx" %>

...

    <cc1:ConfirmButtonExtender ID="CBE1" runat="server" DisplayModalPopupID="mpeConfirmaDelecao" TargetControlID="cmdApagar"></cc1:ConfirmButtonExtender><cc1:modalpopupextender id="mpeConfirmaDelecao" runat="server" 
        OkControlID="General_messages1$cmdOk" 
        CancelControlID="General_messages1$cmdCancel"    	  
	    targetcontrolid="cmdApagar" 
	    popupcontrolid="General_messages1$Panel_Msgbox_Delecao" 
	    popupdraghandlecontrolid="General_messages1$PopupHeader"  
	    backgroundcssclass="Fundo_Ao_Exibir_Painel" ></cc1:modalpopupextender>

Aspx Codebehinde

        Me.mpeConfirmaDelecao.Show()

        If Session("Confirm_Delection") <> "1" Then
            Exit Sub
        End If

Session("Confirm_Delection") Always returns "Nothing".

Someone could please help me ?

Method error 500

$
0
0

I'm using cascading drop down where parent drop down is populating right but child drop down is giving "method error 500"

HTML 

<asp:DropDownList ID="ddlCountries" runat="server" Width="150"></asp:DropDownList><cc1:CascadingDropDown ID="cdlCountries" TargetControlID="ddlCountries" PromptText="Select Country"
                PromptValue="" ServicePath="ServiceCS.asmx" ServiceMethod="GetCountries" runat="server"
                Category="CountryId" LoadingText="Loading..." /><asp:DropDownList ID="ddlStates" runat="server" Width="150"></asp:DropDownList><cc1:CascadingDropDown ID="cdlStates" TargetControlID="ddlStates" PromptText="Select State"
                PromptValue="" ServicePath="ServiceCS.asmx" ServiceMethod="GetStates" runat="server"
                Category="StateId" ParentControlID="ddlCountries" LoadingText="Loading..." />

Cs files

using System;
using System.Web;
using System.Web.Services;
using System.Data;
using MySql.Data.MySqlClient;
using System.Configuration;
using AjaxControlToolkit;
using System.Collections.Generic;

/// <summary>
/// Summary description for ServiceCS
/// </summary>
[WebService(Namespace = "http://tempuri.org/")]
[WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
[System.Web.Script.Services.ScriptService]
public class ServiceCS : System.Web.Services.WebService
{
    [WebMethod]
    public CascadingDropDownNameValue[] GetCountries(string knownCategoryValues)
    {
        string puser = User.Identity.Name;
        string query = "select Dbname, Dbid from db where Username = '" + puser + "';";
        List<CascadingDropDownNameValue> countries = GetData(query);
        return countries.ToArray();
    }

    [WebMethod]
    public CascadingDropDownNameValue[] GetStates(string knownCategoryValues)
    {
        string country = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)["Dbid"];
        string query = string.Format(" select tableName, tableid from tableformula where Dbid = {0}", country);
        List<CascadingDropDownNameValue> states = GetData(query);
        return states.ToArray();
    }



    private List<CascadingDropDownNameValue> GetData(string query)
    {
        string conString = ConfigurationManager.ConnectionStrings["ConnectionString"].ConnectionString;
        MySqlCommand cmd = new MySqlCommand(query);
        List<CascadingDropDownNameValue> values = new List<CascadingDropDownNameValue>();
        using (MySqlConnection con = new MySqlConnection(conString))
        {
            con.Open();
            cmd.Connection = con;
            using (MySqlDataReader reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    values.Add(new CascadingDropDownNameValue
                    {
                        name = reader[0].ToString(),
                        value = reader[1].ToString()
                    });
                }
                reader.Close();
                con.Close();
                return values;
            }
        }
    }
}

the problem is in the getstates function


ajaxToolkit:AjaxFileUpload capture file name and filetype

$
0
0

I am using AjaxFileUpload to upload the files.

1. I need to allow users to only upload text file. I used  AllowedFileTypes="txt" and it does not work.

<ajaxToolkit:AjaxFileUploadID="AjaxFileUpload1" runat="server"OnUploadComplete="AjaxFileUpload1_UploadComplete"AllowedFileTypes="txt"ClientIDMode="AutoID"OnClientUploadError="uploadError"MaximumNumberOfFiles="10"/>    

2. I need to allow users to upload only files that  starts with SAGdesc.txt, SAGhelp.txt. How do I check the file names before uploading. If the file name is other than display a message to upload only files that start with SAGdesc and SAGhelp.

Thanks.

Cascading Dropdownlist not retreiving values

$
0
0

Hi All,

I cannot understand what's wrong with the below code but the dropdownlists are not populated as expected.

<asp:DropDownList ID="ddlcontinents" runat="server" CssClass="ddlcontent"></asp:DropDownList><cc1:CascadingDropDown ID="ccdddlcontinents" runat="server" 
        TargetControlID="ddlcontinents"
        PromptText="Select Continents"
        PromptValue=""
        ServicePath="ccdregioncountry.asmx"
        ServiceMethod="GetContinents"
        Category="Continent" /><asp:DropDownList ID="ddlcountries" runat="server"  CssClass="ddlcontent"> </asp:DropDownList><cc1:CascadingDropDown ID="ccdddlcountries" runat="server" 
        TargetControlID="ddlcountries"   
PromptText="Select Country"
PromptValue=""
ServicePath="ccdregioncountry.asmx"
ServiceMethod="GetCountries"
Category="Country"/>

I created a webmethod as follows:

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Data
Imports System.Data.SqlClient
Imports System.Configuration
Imports AjaxControlToolkit
Imports System.Collections.Generic<WebService([Namespace]:="http://tempuri.org/")> _<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _<System.Web.Script.Services.ScriptService()> _
Public Class ccdregioncountry
    Inherits System.Web.Services.WebService
    Private conString As String = System.Configuration.ConfigurationManager.ConnectionStrings("DefaultConnection").ToString()<WebMethod> _
    Public Function GetContinents(knownContinentValues As String, Continent As String) As CascadingDropDownNameValue()
        Dim sqlConn As New SqlConnection(conString)
        sqlConn.Open()
        Dim sqlSelect As New SqlCommand("SELECT ContinentName, ContinentId FROM Continents", sqlConn)
        sqlSelect.CommandType = System.Data.CommandType.Text
        Dim sqlAdapter As New SqlDataAdapter(sqlSelect)
        Dim myDataset As New DataSet()
        sqlAdapter.Fill(myDataset)
        sqlConn.Close()
        Dim cascadingValues As New List(Of CascadingDropDownNameValue)()
        For Each dRow As DataRow In myDataset.Tables(0).Rows
            Dim ContinentId As String = dRow("ContinentId").ToString()
            Dim ContinentName As String = dRow("ContinentName").ToString()
            cascadingValues.Add(New CascadingDropDownNameValue(ContinentName, ContinentId))
        Next
        Return cascadingValues.ToArray()
    End Function<WebMethod> _
    Public Function GetCountries(knownContinentValues As String, Continent As String) As CascadingDropDownNameValue()
        Dim ContinentId As Integer
        Dim continentValues As StringDictionary = CascadingDropDown.ParseKnownCategoryValuesString(knownContinentValues)
        ContinentId = Convert.ToInt32(continentValues("Continent"))
        Dim sqlConn As New SqlConnection(conString)
        sqlConn.Open()
        Dim sqlSelect As New SqlCommand("SELECT CountryName, CountryId FROM Countries WHERE ContinentId=@ContinentId", sqlConn)
        sqlSelect.CommandType = System.Data.CommandType.Text
        sqlSelect.Parameters.Add("@ContinentId", SqlDbType.Int).Value = ContinentId
        Dim sqlAdapter As New SqlDataAdapter(sqlSelect)
        Dim myDataset As New DataSet()
        sqlAdapter.Fill(myDataset)
        sqlConn.Close()
        Dim cascadingValues As New List(Of CascadingDropDownNameValue)()
        For Each dRow As DataRow In myDataset.Tables(0).Rows
            Dim CountryId As String = dRow("CountryId").ToString()
            Dim CountryName As String = dRow("CountryName").ToString()
            cascadingValues.Add(New CascadingDropDownNameValue(CountryName, CountryId))
        Next
        Return cascadingValues.ToArray()
    End Function
End Class

Thank you in advance for  helping me out in double checking where is the error here.

Toolkit Greyed Out In Toolbox

$
0
0

I just setup a new pc with Visual Studio 2012.  I installed the AJAX Control Toolkit v15.1.  I then started to create a new website for our company.  When I get to a page I need the calendar control on, I am seeing the Toolkit controls are all greyed out in the Toolbox.  The site I am creating is a .NET 4 site and the IIS version that it will be going to is 6.0 on a Windows 2003 server.  The pc I am developing on is a Dell Precision running Windows 7 Professional.

Any and all help is appreciated.

Pager only works with input type search or text

$
0
0
<form method="get" action="@Url.Action("Index")" data-cfdb-ajax="true" data-cfdb-target="#stasjonListe"><input type="search" placeholder="Search" name="searchTerm" /></form><form method="get" action="@Url.Action("Index", "Stasjoner", new {regionTerm = 1 })"
data-cfdb-ajax="true" data-cfdb-target="#stasjonListe"><input type="button" name="regionTerm" value="Test" /></form>

So when i click on page 2, the querystring is ?page=2&searchTerm=

If i change regionTerm input to type="search\text" the querystring is ?page2&searchTerm=&regionTerm=

Here is my Ajax\jquery code:

    var ajaxFormSubmit = function () {
        // grab a reference to the form to be submitted
        var $form = $(this);
        // options object
        var options = {
            // url we are going to
            url: $form.attr("action"),
            //type of request to make
            type: $form.attr("method"),
            // data to send to server
            data: $form.serialize()
        };

        // make async call
        $.ajax(options).done(function (data) {
            // target to update
            var $target = $($form.attr("data-cfdb-target"));
            // replace target with anything from server
            var $newHtml = $(data);$target.replaceWith($newHtml);$newHtml.effect("highlight");
        });

return false;
};
var getPage = function () { var $a = $(this); var options = { url: $a.attr("href"), data: $("form").serialize(), type: "get" };$.ajax(options).done(function (data) { var target = $a.parents("div.pagedList").attr("data-cfdb-target");$(target).replaceWith(data); }) .always(function () { showModal(); }); return false; }; $("form[data-cfdb-ajax='true']").submit(ajaxFormSubmit);$(".body-content").on("click", ".pagedList a", getPage);

 

An error occurred processing a web or script resource request: AjaxControlToolkit

$
0
0

I keep getting this error in my Event Logs. Can you tell anything from this? (I've changed the name of the website)

3012
An error occurred processing a web or script resource request. The requested resource 'pAjaxControlToolkit|AjaxControlToolkit.Images.Tabs.ActiveLeft-VerticalLeft' does not exist or there was a problem loading it.
5/22/2015 12:18:39 PM
5/22/2015 5:18:39 PM
1f387bd772ce4bd1911bb698cb318b4c
39194
8
0
/LM/W3SVC/4/ROOT-1-130767762677286605
Full
/
D:\websites\ssss.com\wwwroot\
WEB
36664
w3wp.exe
IIS APPPOOL\ssss.com
http://www.ssss.com/WebResource.axd?d=4m5SvB6IZ87HRFlMwBRLaqkIMVzhKVKGMQiUHCdwbd4imd3Mg9Gm7AH6Fed_hdIahBlmhBOHWdjc_0CDZIFRoU2HPKihvTnQMH-W5tikQu1u0Y69nUR6CE66RG7WNai5Qshn8bqWtUEwR34rpK2TmYo4c7QxY_ZcN0dUN6yeocbFJvJA0&t=635677065125040678
/WebResource.axd
70.39.185.245
False
IIS APPPOOL\ssss.com
63
IIS APPPOOL\ssss.com
False
e

Unknown server tag 'ajaxToolkit:ToolkitScriptManager'

$
0
0

<%

@PageLanguage="C#"AutoEventWireup="true"CodeFile="Default.aspx.cs"Inherits="_Default" %><!DOCTYPEhtmlPUBLIC"-//W3C//DTD XHTML 1.1//EN""http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

<

htmlxmlns="http://www.w3.org/1999/xhtml">

<

headrunat="server"><title>Untitled Page</title>

</

head>

<

body>

<formid="form1"runat="server">

<ajaxToolkit:ToolkitScriptManagerID="ScriptManager1"runat="server"/>

<div>

</div></form>

</

body>

</

html>

 When trying to view this page in a browser, I get the following error:

Unknown server tag 'ajaxToolkit:ToolkitScriptManager'

I have tried re-installing the AJAX Extensions and AJAX Control Toolkit numerous times but, same result.

Any clues ?? 

Heres the web.config also

<?xmlversion="1.0"?>

<

configuration><configSections>

<

sectionGroupname="system.web.extensions"type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"><sectionGroupname="scripting"type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<

sectionname="scriptResourceHandler"type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="MachineToApplication"/><sectionGroupname="webServices"type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35">

<

sectionname="jsonSerialization"type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="Everywhere" /><sectionname="profileService"type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="MachineToApplication" />

<

sectionname="authenticationService"type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"requirePermission="false"allowDefinition="MachineToApplication" /></sectionGroup>

</

sectionGroup></sectionGroup>

</

configSections><system.web>

<

pages><controls>

<

addtagPrefix="asp"namespace="System.Web.UI"assembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><addnamespace="AjaxControlToolkit"assembly="AjaxControlToolkit"tagPrefix="ajaxToolkit"/>

</

controls></pages>

<!--

Set compilation debug="true" to insert debugging

symbols into the compiled page. Because this

affects performance, set this value to true only

during development.

-->

<

compilationdebug="false"><assemblies>

<

addassembly="System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></assemblies>

</

compilation><httpHandlers>

<

removeverb="*"path="*.asmx"/><addverb="*"path="*.asmx"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addverb="*"path="*_AppService.axd"validate="false"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/><addverb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"validate="false"/>

</

httpHandlers><httpModules>

<

addname="ScriptModule"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/></httpModules>

</

system.web><system.web.extensions>

<

scripting><webServices>

<!--

Uncomment this line to customize maxJsonLength and add a custom converter-->

<!--

<jsonSerialization maxJsonLength="500">

<converters>

<add name="ConvertMe" type="Acme.SubAcme.ConvertMeTypeConverter"/>

</converters>

</jsonSerialization>

-->

<!--

Uncomment this line to enable the authentication service. Include requireSSL="true" if appropriate.-->

<!--

<authenticationService enabled="true" requireSSL = "true|false"/>

--><!-- Uncomment these lines to enable the profile service. To allow profile properties to be retrieved

and modified in ASP.NET AJAX applications, you need to add each property name to the readAccessProperties and

writeAccessProperties attributes.

-->

<!--

<profileService enabled="true"

readAccessProperties="propertyname1,propertyname2"

writeAccessProperties="propertyname1,propertyname2" />

-->

</

webServices>

<!--

<scriptResourceHandler enableCompression="true" enableCaching="true" />

-->

</

scripting></system.web.extensions>

<

system.webServer><validationvalidateIntegratedModeConfiguration="false"/>

<

modules><addname="ScriptModule"preCondition="integratedMode"type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

</

modules><handlers>

<

removename="WebServiceHandlerFactory-Integrated" />

<

addname="ScriptHandlerFactory"verb="*"path="*.asmx"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addname="ScriptHandlerFactoryAppServices"verb="*"path="*_AppService.axd"preCondition="integratedMode"type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>

<

addname="ScriptResource"preCondition="integratedMode"verb="GET,HEAD"path="ScriptResource.axd"type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" /></handlers>

</

system.webServer>

</

configuration>

Cascading DropDownLists using AJAX and jQuery

$
0
0

I am trying to Cascade DropDownLists using AJAX and jQuery.

I am uncertain of the DropdownList1 jQuery SelectedIndexChanged    " $("#<%= DropDownList1.ClientID %> option:selected").trigger(function () { "

Here is my code:

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><script type="text/javascript">$(document).ready(function () {$("#<%= DropDownList1.ClientID %> option:selected").trigger(function () {
                var ddl1SelectedValue = $("#<%= DropDownList1.ClientID %> option:selected").val();
                var data2 = { Value2: ddl1SelectedValue };
                var json2 = JSON.stringify(data2);$.ajax
                ({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    data: json2,
                    url: "Default.aspx/BindSubfolder2",
                    success: function (result2) {$.each(result2, function () {$("#<%=DropDownList2.ClientID %>").append($("<option></option>").val(this['RemoteURL']).html(this['RemoteNumber']));
                        });
                    },
                    error: function (status, ex) {
                        alert("Error Code: Status: " + status + " Ex: " + ex);
                    }
                });
            });
        });</script>


Does not redirect page after UploadComplete in AsyncFileUpload c#

$
0
0

I am using Ajax AsyncFileUpload in asp.net. It is working fine in uploading image but don't know why it is redirecting to same page with some querystring OnUploadComplete. I don't want to reload page. How to solve this ?

My Code is as below:

function uploadComplete() {
    document.getElementById('<%=lblPhotoUpload.ClientID %>').innerHTML = "Quiz Image Uploaded Successfully.";$("#UploadQuizImageProcess").hide();
}

function uploadError() {
     document.getElementById('<%=lblPhotoUpload.ClientID %>').innerHTML = "File Upload Failed.";$("#UploadQuizImageProcess").hide();
}
function uploadQuizImageStart() {$("#UploadQuizImageProcess").show();
}<asp:AsyncFileUpload ID="fuPhoto" runat="server" UploadingBackColor="#779ED3" CompleteBackColor="#179406" ThrobberID="imgLoad" OnUploadedComplete="QuizImageUploadComplete" OnClientUploadStarted="uploadQuizImageStart" OnClientUploadComplete="uploadComplete" OnClientUploadError="uploadError" UploaderStyle="Traditional" /><span id="UploadQuizImageProcess" style="display: none"><img src="../images/uploading.gif" alt="Upload" /></span><asp:Label ID="lblPhotoUpload" runat="server" CssClass="lbler"></asp:Label>

protected void QuizImageUploadComplete(object sender, AsyncFileUploadEventArgs e)
    {
        if (fuPhoto.HasFile)
        {
            string filename = "";
            filename = "quiz" + ".jpg";

            // Save Image
        }
    }

Textbox in separate updatepanel flickering

$
0
0

I've been searching for a solution with no luck.

I use Ajax update panels frequently for rich postbacks with my database.

but even though I have separate update panels set to "conditional", the textboxes still "flicker" or lose focus during a postback?

I don't want any text boxes flickering when I post a message. 

I won't post any code because all my code is working and I have no errors, but I'm using Ajax 3.5 and net 3.5. 

This must be a notorious issue that I haven't found a solution for.

Thank you for any help or insight!

David

UpdatePanel-hosted TextBox is not sent via button click

$
0
0

Hi,

I've got a .NET 4.0 WebForms project with 2 UpdatePanels and textbox in one of them. When I enter text in "Group" textbox and then click on "Save ASYNC" button, the proper server function is called but nothing comes to txtGroup. I wonder what's wrong with my project and how to fix the issue. Below is my ASPX page:

<%@ Page Title="Home Page" Language="C#" MasterPageFile="~/DEF.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %>


<asp:Content ID="Content2" ContentPlaceHolderID="PlaceHolderBodyAreaClass" runat="server">
        <link href="Content/css/jquery-ui.css" rel="stylesheet" type="text/css" />
        <link href="Content/CSS/AdminStyles.css" rel="stylesheet" type="text/css" />
</asp:Content>

<asp:Content ID="Content1" ContentPlaceHolderID="PlaceHolderAdditionalPageHead" runat="server">

    <script type="text/javascript" src="Scripts/js/jquery-1.11.2.js"></script>
    <script type="text/javascript" src="Scripts/js/jquery-ui.js"></script>

</asp:Content>


<asp:Content ID="BodyContent" ContentPlaceHolderID="PlaceHolderMain" runat="server">

    <asp:UpdatePanel ID="UpdatePanel4" runat="server"  >
        <ContentTemplate>
            <asp:Label ID="lblError" runat="server"  ForeColor="Red" Text=""></asp:Label>
            <asp:Button ClientIDMode="Static" ID="Button1" runat="server" Text="DIALOG"
                OnClientClick="Dlg();return false;"
                />
        </ContentTemplate>
    </asp:UpdatePanel>

    <div id="dialogQuests" class="dialogQuestsClass">
        <div class="headerDivBlock">QUESTION</div>
        <div class="contentDivBlock">
            <asp:UpdatePanel ID="UpdatePanel6" runat="server" >
                <ContentTemplate>
                    <table id="tableSizePositionQuest">
                        <tr>
                            <td>Group:</td>
                            <td>
                                <asp:TextBox ID="txtGroup" runat="server"></asp:TextBox>
                            </td>
                        </tr>
                        <tr>
                            <td colspan="2">
                                <asp:Button ID="btnQuestSave" runat="server" UseSubmitBehavior="false" Text="Save ASYNC" OnClick="btnQuestSave_Click"  />
                            </td>
                        </tr>
                    </table>
                </ContentTemplate>
            </asp:UpdatePanel>
        </div>
    </div>


    <script type="text/javascript">

        function Dlg()
        {
            $('#dialogQuests').dialog({ minWidth: 840, resizable: true });
        }

    </script>

</asp:Content>

AsyncFileUpload access controls after completed uploading

$
0
0

Hi 

I want to show a message to user in a label on the page after uploaded file completed but it seems that UploadedComplete event of AsyncFileUpload  does not update the text property of the label control

please give me an example how to do that in visual basic code for aspx page

VS 2008 and VS 2012

$
0
0

Hello,

I have a new laptop that I need to install Visual Studio 2008 and Visual Studio 2012 on.  Should I install both versions of Visual Studio before downloading the AJAX toolkit?

How will this work?  Should I install two versions of AJAX one for 2008 and another for 2012, or would a current version of AJAX cover both of them. Thanks

Viewing all 5678 articles
Browse latest View live


Latest Images