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

Identify axd file content type?

$
0
0

I've successfully created a module to minify asp.net default axd files that render only javascripts, but with AjaxControlToolkit I need to differentiate the content type weather it is css or image or javascript, please not that (Request/Response).ContentType is returning text/html

public class ParseAXD : IHttpModule
{
    public void Init(HttpApplication context)
    {
        context.BeginRequest += context_BeginRequest;
    }

    void context_BeginRequest(object sender, EventArgs e)
    {
        var context = HttpContext.Current;
        var path = context.Request.Url.PathAndQuery;
        if (path.ToLower().Contains(".axd") && IfNotWebClientRequest())
        {
            var remote = new Uri(Lib.SiteDb.DomainName + path);
            using (WebClient client = new WebClient())
            {
                string content = client.DownloadString(remote);

//Need to identify the ContentType here, please not that (Request/Response).ContentType is returning text/html
var settings = new CodeSettings(); settings.MinifyCode = true; settings.LocalRenaming = LocalRenaming.CrunchAll; settings.RemoveFunctionExpressionNames = true; settings.EvalTreatment = EvalTreatment.MakeAllSafe; content = new Minifier().MinifyJavaScript(content, settings); context.Response.ContentType = "text/javascript"; context.Response.Write(content); context.Response.Cache.SetValidUntilExpires(true); context.Response.Cache.SetExpires(DateTime.Now.AddMonths(1)); context.Response.Cache.SetCacheability(HttpCacheability.Public); context.Response.Cache.SetOmitVaryStar(true); context.Response.Flush(); context.Response.End(); } } }


AJAX ToolKit HTML Extender

$
0
0

Hi Guys,

I'm using the AJAX HTML Extender for a form in my Web App. I would like to allow users to insert an image from an external URL. But when I add the Insert Image button it brings up the Upload Image dialog Box. This would be fine as a solution but the Upload Box doesn't upload or compile.

When I try to run my application in Debug mode I get the following error:

Unhandled exception at line 241, column 5 in http://localhost:56057/Admin/dev/HTML.aspx

0x800a1391 - JavaScript runtime error: 'ajaxFileUpload_OnUploadComplete' is undefined

If there is a handler for this exception, the program may be safely continued

What is the issue here? My Code is as follows;

<div><cc1:ToolkitScriptManager ID="ScriptManager" runat="server" /><cc1:AjaxFileUpload ID="ajaxFileUpload" runat="server" OnClientUploadComplete="ajaxFileUpload_OnUploadComplete" /></div>

C#

protected void ajaxFileUpload_OnUploadComplete(object sender, AjaxControlToolkit.AjaxFileUploadEventArgs e)
        {
            string filePath = "~/Images/" + e.FileName;
            ajaxFileUpload.SaveAs(MapPath(filePath));
        }

Does any know what is wrong here?

Enter event issue in textbox because of update panel inside updatepanel

$
0
0

Hi Friends,

I have some issue in my code.

This is search functionality code. When I enter some text in textbox and click search, the results are displaying correctly. But when I enter text in textbox and click enter without pressing search button , all results are displaying irrespective of text which I entered. Please let me know any issues with the code.

This is the sample code. Based on the below sample code when I enter text in textbox and enter, it is always firing "Letter_Click" event. not hidden search button click. I dont know why this issue is happenning. Is it because of update panel or I am not sure.Please can you help me out from this issue.

 

<!--Update Progress is now out of the update panel, otherwise we were getting some JScript errors--> <div class="updateProgress"> <asp:UpdateProgress ID="updateProgress" AssociatedUpdatePanelID="UpdatePanel1" DynamicLayout="false" DisplayAfter="0" runat="server">    <ProgressTemplate>         <asp:Image ID="Image3" ImageUrl="~/Images/spinner_small.gif" runat="server" AlternateText="" GenerateEmptyAlternateText="true" />     </ProgressTemplate> </asp:UpdateProgress> </div>    <asp:UpdatePanel ID="UpdatePanel1" runat="server" Visible="true" >            <ContentTemplate>        

                         <asp:Panel ID="paraPanel" Visible="false" runat="server" Style="cursor: move;background-color:white;border:solid 1px Gray;color:blue">               </asp:Panel>         <div id="pcontent">       <div class="messagepanel">        <mes:Message ID="userMessage" runat="server"/>     </div>                 <asp:UpdatePanel ID="upLetters" runat="server"  UpdateMode = "Conditional" Visible="true" RenderMode="Inline">            <ContentTemplate>      <ul class="searchbar">          <li class="firstitem"><asp:ImageButton id="btn_" runat="server" CommandArgument="_" OnClick="Letter_Click" ImageUrl="~/images/popup/hash.gif" AlternateText="Search #" Width="19" Height="18" TabIndex="-1" CausesValidation="false" /></li>          <li><asp:ImageButton id="btnA" runat="server" CommandArgument="A" OnClick="Letter_Click" ImageUrl="~/images/popup/A.gif" AlternateText="Search A" Width="19" Height="18" TabIndex="-1" CausesValidation="false" /></li>            </ContentTemplate>    </asp:UpdatePanel>

</div> <!--pcontent-->

    <div class="searchtxtbox" runat=server id="searchtxtbox">         <asp:label id="lblCriteriaCaption" AssociatedControlID="txtSearchCriteria" runat="server">Missing Title</asp:label>         <asp:TextBox ID="txtSearchCriteria" runat="server" TabIndex="1"></asp:TextBox>    </div>       <div class="searchbtn">         <asp:ImageButton id="btnSearch" OnClick="btnSearch_Click"  runat="server" ImageUrl="~/images/search_btn.gif" AlternateText="Search" CausesValidation="false"/>         <asp:ImageButton id="btnHiddenSearch" OnClick="btnHiddenSearch_Click"  runat="server" ImageUrl="~/images/search_btn.gif" AlternateText="Search hidden" CausesValidation="false" style="display:none"/>         </div>

    </ContentTemplate>    </asp:UpdatePanel>

Thanks Bhavani

MaskedEditExtender(ASP.net AjaxControlToolkit ) ASP.NET Textbox copy and paste is not copy last digit

$
0
0

Dear All,

I have asp.net text box and MaskedEditExtender to get USA Phone no as input. it works fine.

When I copy the data from the text box and paste it in same or similar control, the last digit was not copied. I think, it also copies parenthesis, so it is not pasting full no.

I found that, if I copy the phone no to notepad / normal Text box and remove Bracket / Parenthesis, it copy full data.

I want user to copy and just paste it. Can any one help me.

<asp:TextBox ID="tbPhoneNum" runat="server" CssClass="BidsTextBox" Width="140px" MaxLength="13"></asp:TextBox><cc1:MaskedEditExtender ID="PhoneTextBox" Mask="(999) 999-9999" MaskType="None" runat="server" ClearMaskOnLostFocus="false" TargetControlID="tbPhoneNum" />

similarly for Fax input.

when user copied from phone to fax or when two instance, copy from phone to phone. I face this problem.

if user copy (121) 121-1212 and paste it 
the value is (121) 121-121. last digit is missing
if I copy 121 121-1212 without braces from normal text box / note pad then, it copy all digit.

Can any one help me.

Thanks

Palanivelrajan

ASP.Net 4.5 Validation Controls not working with AJAX ToolkitScriptManager1

$
0
0

All,

I have a project in which I am using the 'unobtrusive.....' validation so it includes the references to all the JScript libraries in the global.asax. I also have pages that utilize the ASP.Net Validation controls and summary. For some reason I cannot get the validation controls to work correctly. Below is a summary of my challengers:

1. The first time the page loads, on the client side, when tabbing out of a field that has a required field validator attached to it, the "text" assigned to the validator does not display

2. If I click the submit button, the "text" associated with the required field validator now displays but I don't get the pop-up window from my validation summary.

3. If I then enter text in the text boxes that have required field validators assigned, the "text" assigned will not disappear until I click on the submit button.

My ASPX page code is below and I have nothing in my code behind.  I have also tried with the script manager inside and outside the update panel.  Any assistance would be greatly appreciated.  

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test1.aspx.vb" Inherits="test1" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title></head><body><form id="form1" runat="server"><asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" ></asp:ToolkitScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><div><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label><asp:TextBox ID="TextBox1" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="TextBox1" ErrorMessage="RequiredFieldValidator" ValidationGroup="contentgroup">*</asp:RequiredFieldValidator><br /><asp:Label ID="Label2" runat="server" Text="Label"></asp:Label><asp:TextBox ID="TextBox2" runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="TextBox2" ErrorMessage="RequiredFieldValidator"  ValidationGroup="contentgroup">*</asp:RequiredFieldValidator><br /><asp:Button ID="Button1" runat="server" Text="Button" ValidationGroup="contentgroup" /><asp:ValidationSummary ID="ValidationSummary1" runat="server" ValidationGroup="contentgroup" ShowMessageBox="True" ShowSummary="False" /></div></ContentTemplate></asp:UpdatePanel></form></body></html>

TabContainer Issue

$
0
0

Dear All,

I have 4 tabs "A","B","C" and "D". Tab A is selected my default. When I go from tab "A" to any other tab the following event fires

protected void tabT_ActiveTabChanged(object sender, EventArgs e)
{
     Session["TabIndex"] = null;
     Session["TabIndex"] = tab.ActiveTabIndex;
     if (Request.QueryString["id"] == null)
    { 
        Response.Redirect("products.aspx?id=" + Session["pkid"]);
     }

}

which is working correctly.  But I want the same thing to happen when I click the default tab "A".  The problem is that the above ActiveTabChanged event does not  get fired when the default tab is clicked.  I want the above event to get fired when the default tab is also clicked.

Any help would be greatly appreciated.

cheers,

Sam

AJAX Calendar Extender customization questions

$
0
0

Hi All,

 I am working on a AJAX calendar extender and I would like to understand what is the best mothod that one should follow in order to:

  • When we open the calendar via AJAX calendar extender and we are in a month, let's say April, this month is also populated with some days belonging to May and some belonging to March.Is it possible to completely remove those days that do not belong to the month selected?
  • When we pass the mouse over a day, we see that there is a small tooltip coming up. This is because if we look at the HTML code generated by AJAX the div contains the "title" tag:is it possible to get rid of this?
<div id="MainContent_CalendarExtender2_day_2_6" class="ajax__calendar_day" title="Sunday, April 19, 2015">19</div>
  • How can I disable the functionality to navigate in the month and year views? To better explain myself, when we open the calendar we see that in the header of it the month and year is shown as a link. If you click on this link you navigate to the month view and then on the year view.

  • Imagine we have 2 calendar extender (FROM - TO). How can I disable in the  TO Calendar extender the days prior to the date selected in the FROM calendar? As for example, if I select April 1st in the FROM Calendar, how can I disable all dates from Jan 1st to April 1st  in the TO calendar?

  • Possibly, is there a way to show a 2 month calendar instead of the default 1 month view?

Thank you so much

Page loading time loading two partial views every 30 seconds

$
0
0

I have two partial views which I am loading every few seconds usign ajax and set interval. TesterPartialView is taking mostly lesser time(ms) though not always and ViewAttributes1 makes calls to database and loads data from database every 30 seconds and it is taking a lot of time to load most of the time though not consistent. I am only testing my app in my local machine and I see loading time in ms and seconds. Couple of questions

  1. Why isn't the loading time consistent? sometimes one view is faster and sometimes not and the same for the other view too. It is highlighted in the image
  2. Is this a normal loading time? 500ms or .50 seconds for loading a view on your local machine, local web server and local database?If not what can I do to improve performance.
  3. My requirement is DB gets updated by another program and hence I did the set interval in jquery and calling controller method every 30 seconds to get the updated data and then load the view.

I am using asp.net MVC 4 with sql server 2012 and VS 2013. Please advise. 


jQuery and UpdatePanel.Cannot save jQuery action result.

$
0
0

I know well there is huge number of articles and posts regarding this problem. Seemed I tried all of them but with no success.
Ok, so what I'm trying to do is:

  1. Change GridView orders from jQuery by manipulating tr.
  2. Post new rows positions to webservice.
  3. Notify users by server side event about changes.

Everything work fine till the moment when I press 

Button1
 - all changes revert back, but when page reloaded, I see that all changes saved. GridView and Button are web controls existing on UserControl. Here is UserControl markup.
%@ Control Language="C#" AutoEventWireup="true" CodeBehind="TaskGrid.ascx.cs" Inherits="CDSOnline.controls.TaskGrid" %><h1 runat="server" id="h1Header"></h1><asp:UpdatePanel runat="server" UpdateMode="Conditional"><ContentTemplate><section><asp:DropDownList ID="ddlEmployees" runat="server" DataTextField="EmpName" DataValueField="EmpId" OnSelectedIndexChanged="ddlEmployees_SelectedIndexChanged" AutoPostBack="True" AppendDataBoundItems="True"><asp:ListItem>Please Select Tester</asp:ListItem></asp:DropDownList><asp:Button ID="Button1" runat="server" Text="Notify Tester" OnClick="Button1_Click" /></section><asp:GridView ID="gridItems" runat="server" AutoGenerateColumns="False" CssClass="style1" PagerStyle-CssClass="gridpagerstyle" Style='width: auto' DataKeyNames="EntityId"><Columns><asp:TemplateField HeaderStyle-HorizontalAlign="Left" ItemStyle-CssClass="entitydata"><ItemTemplate><asp:Literal ID="lit1" runat="server" Text='<%# Bind("EntityType") %>'></asp:Literal><asp:Literal ID="lit2" runat="server" Text='<%# Bind("EntityId") %>'></asp:Literal></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Title" HeaderStyle-Width="25%"><ItemTemplate><asp:HyperLink ID="Hyperlink1" runat="server" CssClass="SimpleHyperLink" NavigateUrl='<%# GetUrl(Convert.ToString(Eval("EntityType")), Convert.ToString(Eval("EntityId"))) %>' Text='<%# Eval("EnityTitle") %>' /></ItemTemplate></asp:TemplateField><asp:TemplateField HeaderText="Project" SortExpression="ProjectId" HeaderStyle-Width="25%"><ItemTemplate><asp:HyperLink ID="hlProj" runat="server" NavigateUrl='<%# GetUrlProject(Convert.ToInt32(Eval("EntityId"))) %>' Text='<%# Eval("ProjectName") %>' ToolTip='<%# Eval("ProjectName") %>' /><asp:Label runat="server" ID="lblProj" Text='<%# Eval("ProjectName") %>'></asp:Label></ItemTemplate></asp:TemplateField><asp:BoundField DataField="Priority" HeaderText="Priority" /><asp:BoundField DataField="Responsible" HeaderText="Responsible" HeaderStyle-Width="20%" /><asp:TemplateField><ItemTemplate><asp:Image ID="ImageButton1" runat="server" ToolTip="move up" ImageUrl="~/images/moveitem_up.ico" CssClass="up" /><asp:Image ID="ImageButton2" runat="server" ToolTip="move down" ImageUrl="~/images/moveitem_down.ico" CssClass="down" /></ItemTemplate></asp:TemplateField><asp:TemplateField><ItemTemplate><asp:Image ID="ImageButton3" runat="server" ToolTip="move to top" ImageUrl="~/images/moveitem_top.ico" CssClass="top" /><asp:Image ID="ImageButton4" runat="server" ToolTip="move to bottom" ImageUrl="~/images/moveitem_bottom.ico" CssClass="bottom" /></ItemTemplate></asp:TemplateField></Columns><EmptyDataTemplate>
                No records found</EmptyDataTemplate></asp:GridView></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="ddlEmployees" EventName="SelectedIndexChanged" /><asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click" /></Triggers></asp:UpdatePanel>

And here is WebForm:

<script type="text/javascript">
        Sys.WebForms.PageRequestManager.getInstance().add_endRequest(MoveRows);
        function MoveRows() {$(".up,.down,.top,.bottom").on('click', function () {
                var ri = $(this).closest('tr').prevAll().length; // 
                var row = $(this).parents("tr:first");
                if ($(this).is(".up")) {
                    if (ri > 1) {
                        row.insertBefore(row.prev());
                    } else {
                        return false;
                    }
                } else if ($(this).is(".down")) {
                    row.insertAfter(row.next());
                } else if ($(this).is(".top")) {
                    row.insertAfter($("#ctl00_MainArea_TaskOrder2_gridItems tr:first"));
                } else {
                    row.insertAfter($("#ctl00_MainArea_TaskOrder2_gridItems tr:last"));
                }
                //Все ряды кроме первого
                var rows = $("#ctl00_MainArea_TaskOrder2_gridItems tr:gt(0)");
                //Сохраняем позици каждого ряда
                rows.each(function () {
                    var entid = $(this).find("td.entitydata").text().match(/\d+/);
                    var rowindex = $(this).index() === 0 ? $(this).index() : $(this).index() - 1;
                    var json = '{"entid": ' + entid + ', "rowindex": ' + rowindex + '}';$.ajax({
                        type: "POST",
                        contentType: "application/json",
                        url: "Positions.asmx/UpdatePositions",
                        data: json,
                        success: {},
                        failure: function () {
                            alert("Failed to move rows.");
                        }
                    });
                });
            });
        }
        //$(document).ready(MoveRows);</script><tg:TaskGrid ID="TaskOrder2" runat="server"></tg:TaskGrid>

webmethod with ajax call not working in firefox

$
0
0

Hi,

Doesn't webmethod work with FireFox?

Here is my html code:

<body><div id="container"> <form id="form1" runat="server"><h1>User Registration Form</h1><div><label for="username">Username:</label><input type="text" name="username" id="username" class="txt" /></div><div><label for="password1">Password:</label><input type="password" name="password1" id="password1" class="txt" /></div><div><input type="submit" id="btn" name="btnSubmit" value="Sign Up!"
                class="btn" /></div><div id="result">message</div></form></div><script type="text/javascript">$(function () {$("#btn").click(function () {$.ajax({
                     type: "POST",
                     url: "Default2.aspx/CheckUser",
                     data: "{'username':'" + $('#username').val() + "','password':'" + $('#password1').val() + "'}",
                       contentType: "application/json; charset=utf-8",
                     dataType: "json",
                     success: OnSuccess,
                     failure: function (response) {
                         alert(response.d);
                     }
                 });
             });
         });
         function OnSuccess(response) {
             alert(response.d);
         }</script></body>

codebehind

[WebMethod]
    public static string CheckUser(string username,string password)
    {
        string retMessage = string.Empty;
        BusinessLogiclayer bl = new BusinessLogiclayer();
        bl.PASSWORD = password;
        bl.FNAME = username;
        bl.Select();
        if (bl.retvalue == 1)
        {
            retMessage = "true";
        }
        else
        {
            retMessage = "false";
        }

         return retMessage;
    }

web.config

<configuration><configSections><sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"><sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"><section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/><sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"><section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/><section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/><section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/><section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/></sectionGroup></sectionGroup></sectionGroup>

Thanks

How to update parent page after AJAX Model Popup Extender closes without postback?

$
0
0

Hi guys .. Before I describe my problem, please note that I'm using MVC and not Web forms. Meaning the solution needs to work within MVC.

I have a button on an ASP.NET page (let's call it Parent Page), which when I press, opens a modal popup which has a form in it which the user fills in. When the form is submitted, I'd like to display the data the user entered in the modal popup on the Parent Page, without doing a postback. How can this be achieved while using MVC ?

The Models I'm using are given below. The Parent Page is for creating aTeam, and the modal popup with take details of a Player. The details are then to be shown on theParent Page in a grid-like view.

public class Team
{
public int ID {get; set;}
public string name {get; set;}
public string slogan {get; set;}
public string homeCity {get; set;}
public List<Player> players {get; set;}
}

public class Player
{
public int ID {get; set;}
public string fullName {get; set;}
public int age {get; set;}
public string height {get; set;}
}



Adding records to SQL Database from Modal popup

$
0
0

Take it easy on me, I'm learning!

I am making a VB application for writing work orders. In the admin section you can define employees, departments and so on.

I had originally used a Gridview to edit/delete and display the information. With some simple controls I was able to add new information to the tables.

To spruce things up I changed the Gridview to a Repeater and used jquery to make a nice looking display. Then I added a button to open a ajax Modal popup with fields to enter a new record.

Once I added the modal none of my code will work for adding records.

I am having a hard time figuring out what exactly I need to learn to add new records from the popup window.

Thanks in advance!

Fast/Bulk Postback handling

$
0
0

I have a search feature that is similar to the google search autocomplete.  I have a textbox that the user enters their search criteria, then with javascript I am automatically clicking a hidden button inside an updatepanel so I can run code on the server.  This all works great until somebody leans on the keyboard and it can't handle that many postbacks is my guess (but it could be something else).

The error I am randomly getting is "The state information is invalid for this page and might be corrupted.".

I made it error less when I try to determine if it is in the middle of a postback by using a variable, but it still errors sometimes:

 If iDuringPostback.Value.ToString = "Yes" Then
        Else
'Refresh Results
End If

Here is the code I am using to add the onKeyUp event:

If Not IsPostBack Then
                txtSearch.Attributes.Add("onKeyUp", "doKeyUp('" + btnSearchHidden.ClientID + "','" + iHiddenSearchValue.ClientID + "',event)")

Adding enableeventvalidation= false in the web.config does not fix the problem.   Any ideas?

EDIT: It appears to only be a problem in IE

Numericalupdownextender wont work inside ModalPopupExtender ?

$
0
0
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="numericaldropdown.aspx.vb" Inherits="ajax_ModalPopup_numericaldropdown" %><%@ Register 
    Assembly="AjaxControlToolkit" 
    Namespace="AjaxControlToolkit" 
    TagPrefix="ajaxToolkit" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><script type="text/javascript">
    function ShowPopUpPercent(obj) {

        if (obj.checked) {
            $find('EditModalPopup').show();
        }
    }</script><title></title></head><body><form id="form1" runat="server"><ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager2" runat="server"></ajaxToolkit:ToolkitScriptManager><div><asp:RadioButton ID="RadioButton2" Text="Percentage Discount"   GroupName="t" runat="server" OnClick="ShowPopUpPercent(this);"   /><br /><asp:HiddenField ID="hiddenTargetControlForModalPopup"  runat="server" /><asp:Panel ID="PnlModalPopup" runat="server" Style="display: none; padding:10px; border:1px; border-style:solid;" BackColor="#FF9933" Width="400px"> <h3 style="text-align: center;" id="h1">Modal Popup</h3> <p style="text-align: center;"> <input id="closeBtn" type="button" value="Done" /><input id="btnCancel" type="button" value="Cancel" /></p>        <asp:TextBox ID="TxtDiscount" ValidationGroup="insertgroup" width="50"     runat="server"></asp:TextBox> <ajaxToolkit:NumericUpDownExtender ID="NumericUpDownExtender1" runat="server" EnableViewState="true"
                    TargetControlID="TxtDiscount"
                    Width="50"
                    RefValues="" 
                    ServiceDownMethod=""
                    ServiceUpMethod=""
                    TargetButtonDownID=""
                    TargetButtonUpID=""
                    step="5" 
                    Minimum = "0"
                    Maximum = "100"
                       /></asp:Panel> <ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender" runat="server" EnableViewState="true" 
            TargetControlID="hiddenTargetControlForModalPopup" 
            PopupControlID="PnlModalPopup"              
            OkControlID="closeBtn" 
            BackgroundCssClass="backgroundColor" 
            DropShadow="true" behaviorid="EditModalPopup"
          /> </div><asp:Button ID="Button1" runat="server" Text="Button" /></form></body></html>

 

I can get it to work on its own yet no in the Modal ?

UpdatePanel is not working

$
0
0

I'm inserting something in mysql database entered by the user in a pop up modal box and then that text is shown in a treeview. So when the save button is clicked the treeview part should auto refresh showing the recently added text. but it is not working and I still have to refresh the page to see the newly inserted text :/

Here is the code

<asp:ScriptManager  ID="ScriptManager1" runat="server" /><asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="updatePanel1"><ContentTemplate><asp:TreeView runat="Server" ExpandImageUrl="~/images/database.png" CollapseImageUrl="~/images/database.png" OnTreeNodePopulate="Node_Populate" ID="tvwauthors" >      <Nodes><asp:TreeNode Text="Existing Database" PopulateOnDemand="true" Value="0"/></Nodes></asp:TreeView></div><div id="dialog-1" title="Add new Database">
      	Database name: <asp:TextBox ID="name" runat="server" ></asp:TextBox><asp:Button Text="Save" class="btn btn-danger" runat="server" id="saveButton" CausesValidation="false" OnClick="SaveDB" style="padding-left:2%;padding-right:2%;" /> </div></ContentTemplate>  <Triggers><asp:AsyncPostBackTrigger ControlID="saveButton" EventName="Click" />        </Triggers></asp:UpdatePanel>     


Upgrading from AjaxControlToolkit 4 to 15

$
0
0

Hi Folks,

I have an asp.net 4 application that uses the AJax Control Toolkit calendar control and HtmlEditor and am upgrading it to 15.  I've removed all of the old Toolkit references and installed the new version using the DevExpress installer.  The new toolkit is showing in Visual Studio 10 toolkit menu and I can drag components onto the screen, however I am getting a 'Missing type or namespace' error.

I notice that I no longer have an assembly reference (the old one was removed), but have not been able to find where the new ones were installed.

My question is, does anyone know where the assemblies are installed on the machine so I can add them as a reference?    Also, how can I ensure that the assemblies and references are copied with the web project when it is published (I cannot use the DevExpress installer in the production environment).

Update:  After having another go at removing everything and dragging a control back onto the design surface, it added the reference to the assembly and copied this into the bin folder (so I guess the second part of my question is answered).  It would still be useful to understand where DevExpress installed the actual product though.

Regards

Andy

AjaxControlToolkit HtmlEditorExtender disabling dropdown postbacks

$
0
0

Hi Folks,

I had this issue in V4 of the AjaxControlToolkit and have replicated it V15.   I have a asp.net 4 forms application with an update panel containing 3 dropdown controls that are daisy chained (selecting the first loads the next one with data and displays it etc.).

The last dropdown when an item is selected makes a text field with an attached HtmlEditorExtender visible.   As soon as this extender, all of the dropdowns lose the ability to postback when selected.

The update panel is set to conditional and children as triggers = false.  I manually call the update() method at the end of each dropdown_changed event. Each dropdown is set to AutoPostback=true.

If I comment out the editor extender, the application works fine, if I uncomment it and make it not visible, the application works fine.  It is only when I make the control visible that the dropdowns fail to post back.

Does anyone have a work-a-round for this?   I have added some code on the Page_Load to re-wire the selected index changed events for the dropdowns, however, this appears to make little difference.

Update:  After some testing, if I make the HtmlEditor extender visible all of the time, the dropdowns never send postbacks. If the control is removed or made non-visible, the dropdowns work).

Update 2: I programmatically added the extender to a panel that was outside of the update panel in CreateChildControls, with the same results. However, I discovered that if I set the Text property of the edit control to something such as "hello World" I appear to be getting postbacks from the drop downs now - so it looks like the issue is with the control not initializing correctly.

Regards

Andy

Styling ajax cascading dropdown how please?

$
0
0

Hello everyone, I would love to add background color to ajax cascading dropdown list when the parent control is selected. Here is my mark up:

<div><asp:DropDownList ID="ddlTest" runat="server"><asp:ListItem>Test1</asp:ListItem><asp:ListItem>Test2</asp:ListItem></asp:DropDownList></div><div class="row margin10"><div><cc1:MyDropdownList ID="ddlCountry" runat="server" DataTextField="country_name" DataValueField="country_id" ValidationGroup="product"></cc1:MyDropdownList><ajaxToolkit:CascadingDropDown ID="cdlCountry" TargetControlID="ddlCountry" PromptText="-- Select country --"
                        PromptValue="0" ServicePath="~/service/CascadingDdl.asmx" ServiceMethod="GetCountry" runat="server"
                        Category="country_id" LoadingText="Loading..." /></div><div><cc1:MyDropdownList ID="ddlState" runat="server" ValidationGroup="product" DataTextField="state_name" DataValueField="state_id"></cc1:MyDropdownList><ajaxToolkit:CascadingDropDown ID="cdlState" TargetControlID="ddlState" PromptText="-- Select state --"
        PromptValue="0" ServicePath="~/service/CascadingDdl.asmx" ServiceMethod="GetState" runat="server"
        Category="country_id" ParentControlID="ddlCountry" LoadingText="Loading..." /></div></div>

So I want to add background color to the ddlState when ddlCountry is selected. Here is my javascript to add the style:

$("select[id*=ddlCountry]").change(function () {$("select[id*=ddlState]").each(function () {$(this).children('option').css("background-color", "red");
                 });
             });

But this doesn't work. I tested my js code to this:

$("select[id*=ddlCountry]").change(function () {$("select[id*=ddlTest]").each(function () {$(this).children('option').css("background-color", "red");
                 });
             });

Then this will work. But I need to populate the child dropdown list dynamically. Anyone knows how I can fix this?

Thanks. 

Select command in the gridview does not choose the correct record in the Ajax Modal Popup Extender.

$
0
0

I hoping this is a simple fix.

I have a gridview using a select command button that I would like to popup a modal extender for each row when the select button is clicked. I would like for the user to view and edit the data in a formview within a Panel.

I have no propblem inserting data or even editing data, but when selecting a record from the gridview displays the first record in the formview everytime.

I have tried many times to search the internet for answers, but had no luck at all! :(

 

What might be the possibilities of AJAXToolkit not working under aspspider.net?

$
0
0

I have uploaded anything, the program is up and running.

But.... The CalendarExtender is not working, no dropdowns for the calendar.

http://ajaxtoolkit.net/

I've uploaded the AJAXControlTookKit.dll to the bin folder.

Everything else, aspx, js, css, Global.asax, master page, my application.publish.xml and web.config as usual.

Everything is up and running except the CalendarExtender is not there.

Resources up'ed (pngs)

What may be the reasons why the CalendarExtender is not showing when being clicked on the date textbox...

Double checked all the files are present...

Viewing all 5678 articles
Browse latest View live




Latest Images