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

Ajax combo box issue in ie 11

$
0
0

I am facing an issue with ajax combo box in ie 11, where the intellisense feature is not working.

In the below code which is executed in script resource.axd

var userRange = document.selection.createRange();

undefined value is being returned in ie 11 where as in ie 10 , it is returning the current length of the text in the combo box.

This is leading to failure.

Any suggestions/workarounds would be of great assitance.

I used the latest available ajax components updated using nuget.

Thanks in advance

code:

_getTextSelectionInfo:function (textBox, e) {

var info = new Object();

info.strategy =this._getTextSelectionStrategy();

if (info.strategy == Sys.Extended.UI.ComboBoxTextSelectionStrategy.Microsoft) {

var userRange = document.selection.createRange();

info.selectionStart = 0;

info.selectionEnd = textBox.value.length;

while (userRange.moveStart('character', -1) != 0) {

info.selectionStart++;

}

while (userRange.moveEnd('character', 1) != 0) {

info.selectionEnd--;

}

}

elseif (info.strategy == Sys.Extended.UI.ComboBoxTextSelectionStrategy.W3C) {

info.selectionStart = textBox.selectionStart;

info.selectionEnd = textBox.selectionEnd;

}

info.typedCharacter = String.fromCharCode(e.charCode);

info.textBoxValue = textBox.value;

info.selectionPrefix = (info.textBoxValue.length >= info.selectionStart)

? info.textBoxValue.substring(0, info.selectionStart)

:'';

info.selectionText = (info.textBoxValue.length >= info.selectionEnd)

? info.textBoxValue.substring(info.selectionStart, info.selectionEnd)

:'';

info.selectionSuffix = (info.textBoxValue.length >= info.selectionEnd)

? info.textBoxValue.substring(info.selectionEnd, info.textBoxValue.length)

:'';

info.selectionTextFirst = info.selectionText.substring(0, 1);

return info;

},


Long running AJAX call graceful abort/error handling

$
0
0

I've been reading a lot of posts and cannot find anything that addresses the issue of long AJAX calls and aborting/handling them.

I'm familar with the timeout values, etc. But I have two issues, here is my object line for the script manager (and I'm using 4.5 web forms so I know it can be just ScriptManager, and maybe tookitmanager is causing issues)

<asp:ToolkitScriptManager ID="SMMasterPage5" ScriptMode="Release" OnAsyncPostBackError="SMMasterPage5_AsyncPostBackError" AsyncPostBackTimeout="600" runat="server" />

The '_AsyncPostBackError' handler isn't working? It never goes into that block. Unless I'm not understanding what is occuring. I've tried to force it by setting to AsyncPostBackTimeout="10" and I just get an AJAX error dialog (but I'm in debug and on my dev machine (maybe this works in release and on server?)).

And the second issue what if I want to stop the call, so that my "Please wait..." doesn't get locked up and spins forever. I would like to gracefully stop the call after x miniutes and return to UI. I have the update panel on a masterpage wrapping the content page.

I'm not using async/await. Straight sync call.

I've searched the web and everything I've found is regarding the timeout setting.

Thanx.

AJAX REPORT

$
0
0

how to implement ajax report? need to install anything such as crystal report?

File Upload inside wizard unable to upload image. Have update panel.

$
0
0

Hi,

I have file upload,button and image control on page.

The below code works in normal asp.net website.

When the file upload is iniside wizard control ,which has update panel ,it does not work.

File upload is inside wizard step 2.

 

<form id="form1" runat="server" enctype="multipart/form-data"><tr><td><asp:FileUpload ID="fileImage" runat="server" /></td><td><asp:Button ID="btnfileupload" runat="server" CausesValidation="false"  CssClass="form_button" OnClick="btnfileupload_Click"
                                                                                                    Text="Upload Image" /></td><td><asp:RegularExpressionValidator ID="RevImg" runat="server" ControlToValidate="fileImage"
                                                                                                    ErrorMessage="Invalid File!(only  .gif, .jpg, .jpeg Files are supported)"
                                                                                                    ValidationExpression="^.+(.jpg|.JPG|.gif|.GIF|.jpeg|JPEG)$" ForeColor="Red"></asp:RegularExpressionValidator></td><td><asp:Image ID="imgPhoto" runat="server" Height="165px" Width="165px"  Visible="false"
                                                                                                    style="margin-left: 0px" /></td></tr>


protected void btnfileupload_Click(object sender, EventArgs e)
    {
if (fileImage.HasFile)
        {
                  


            System.IO.Stream fs = fileImage.PostedFile.InputStream;
            System.IO.BinaryReader br = new System.IO.BinaryReader(fs);
            Byte[] bytesPhoto = br.ReadBytes((Int32)fs.Length);
            string base64String = Convert.ToBase64String(bytesPhoto, 0, bytesPhoto.Length);
            imgPhoto.ImageUrl = "data:image/png;base64," + base64String;
            imgPhoto.Visible = true;
}

}


<Triggers><asp:PostBackTrigger ControlID="wzEmployeeAdministration$WizardStep2$btnfileupload" /></Triggers>

Guhan.

Some caching issues with AJAX Repeater in Chrome

$
0
0

I have simplified the repeater to its bare bones and posted it in hope that you can replicate the problem. To be exact it happens on Chrome and mine is Version 31.0.1650.57 for XP. But it could e on other's versons too.

http://netsetix.com/WebForm1.aspx

So please open this link in Chrome and Add to cart say at least 3 items (it is not real DB driven adding). Then go either Forward or Backward with browser's buttons. Then get back to this page, again with browser's buttons and click on any of the items you previuosly clicked. The problem - all messages on all previuosly clicked items pop at once.

The code

<!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">
    <title>Sample of the Ajax repeater problem. Standart button</title>
    <link href="~/Styles/naviga.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <form id="form1" runat="server">
<h1>Sample of the Ajax repeater problem. Standart button</h1>
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>

<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate>

<asp:Repeater ID="rptFashion" runat="server" EnableTheming="False">
<ITEMTEMPLATE>
<div class="rep_wrapper">
<div class="rep_leftCol"><h2><%# CType(Container.DataItem, System.Data.DataRowView)("product_name")%> </h2>
<asp:Literal ID="ltlAdded" runat="server" Text='<%# CType(Container.DataItem, System.Data.DataRowView)("item_added_message") %>'></asp:Literal></div>
<div class="rep_rightCol"><asp:Button runat="server" Text="Add To Cart" CommandName="bottonAdd" CssClass="buttonWidth" /></div>
<div class="clearBoth"></div></div>            
</ITEMTEMPLATE>
</asp:Repeater>

</ContentTemplate></asp:UpdatePanel>
</form>
</body>
</html>

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not Page.IsPostBack Then

            column = New DataColumn
            column.DataType = System.Type.GetType("System.String")
            column.ColumnName = "product_name"
            dt_source.Columns.Add(column)

            column = New DataColumn
            column.DataType = System.Type.GetType("System.String")
            column.ColumnName = "item_added_message"
            dt_source.Columns.Add(column)

            Dim i As Integer = 0

            For i = 1 To 4

                custrow = dt_source.NewRow()

                custrow("product_name") = "Product " & i.ToString

                custrow("item_added_message") = ""

                dt_source.Rows.Add(custrow)

            Next i

            rptFashion.DataSource = dt_source

            rptFashion.DataBind()

        End If
    End Sub

 Protected Sub rptFashion_ItemCommand(ByVal source As Object, ByVal e As System.Web.UI.WebControls.RepeaterCommandEventArgs) Handles rptFashion.ItemCommand

        If (e.CommandName = "bottonAdd") Then

            Dim frontMessage As Literal = CType(e.Item.FindControl("ltlAdded"), Literal)

            frontMessage.Text = "<p class=""congrad"">Item Added To Cart</p>"

        End If
    End Sub

 

 

 

 

 

GridView without Refresh when m deleting record in gridview

$
0
0

Hi,

i want to delete record in gridview without using Script Manager..

want to delete using ajax..

<asp:GridView ID="GridView1" runat="server" CssClass="table table-hover" AllowPaging = "true" GridLines="None" AutoGenerateColumns="False" OnPageIndexChanging="GridView1_PageIndexChanging">
<Columns>
<asp:TemplateField HeaderText="Order Id">
<ItemTemplate>
<asp:Label ID="lbPassport" runat="server" Text='<%# Bind("[Order Id]") %>'></asp:Label>
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="30px" />
</asp:TemplateField>

<asp:TemplateField HeaderText="Status">
<ItemTemplate>
<a href="#" id="<%# Eval("[Order Id]") %>" onclick='Check(this.id)' class="popup">Show Details </a>

</ItemTemplate>
<ItemStyle HorizontalAlign="Center" Width="30px" />
</asp:TemplateField>

>

</Columns>
</asp:GridView>

<Script>

function Check(obj)

{

here i il get id..passing this id to web Method want to delete that record without Page Refreshing

}

</script>

thanks

Strange IIS Problem?

$
0
0

I have an issue that just recently started;

If I restart my webserver, and a new user visits, it works correctly.

Close the browser and go back to the site, the site never finishes loading (it appears to be doing a post back to itself constantly).


I am not sure if AjaxToolkit.dll is the problem, but I had a similiar issue with the latest version, so I had to use slightly older to get anything to work.


Any clues as to where I should look to solve this, it seems to work fine on my dev server.

Call c# server-side function using xmlhttprequest

$
0
0

I try to upload a file using xmlhttprequest.

Here is my client-side code:

function UploadFile() {

var formData = new FormData();
var file = document.getElementById("file").files[0];
formData.append("file", file);

var uploadServerSideScriptPath = "Login.aspx/test";
var xhr = new XMLHttpRequest();

xhr.open("POST", uploadServerSideScriptPath, false);
xhr.setRequestHeader("Content-Type", "multipart/form-data");
xhr.setRequestHeader("X-File-Name", file.name);
xhr.setRequestHeader("X-File-Size", file.size);
xhr.setRequestHeader("X-File-Type", file.type);


xhr.send(formData);

}



I post to 

Login.aspx/test

test function on server side is:

[WebMethod]
    public static void test(object obj)
    {
        string a = "test";
    }

but I never get to this function. I put a break point but it never being hit.

what am I doing wrong?


Gridview inside UpdatePanel, paging/sorting doesn't work ONLY when using MasterPage

$
0
0

Hi all,

Gridview looks a bit like this:

<asp:UpdatePanel runat="server"
ID="upGdvPendingReview"
ChildrenAsTriggers="true"
UpdateMode="Conditional"><ContentTemplate><asp:GridView
          ID="gdvPendingReview"
          runat="server"
          PageSize="10"
          AllowPaging="true"
          AllowSorting="true"><columnCrudHere></asp:GridView></ContentTemplate></asp:UpdatePanel>

Gridview is bound to linqdatasource using the Selecting event. This code works perfectly without the updatepanel. It also works perfectly if I copy to a page that isn't a Content Page to a Master Page. I've read a lot of posts about gridview issues in update panels with paging and sorting. In fact, there is one where they guy comments at the end that he got it working but it still fails when using a MasterPage. I've tried using a scriptmanager in the same page as the gridview and changing various options of the scriptmanager. To get it working, I just create a new page, copy my gridview, linqdatasource, scriptmanager, and code behind...and boom it works. It makes me wonder if I have something else in the page getting in the way. I do have other updatepanels where I can update content fine. So, this...combined with the post where the same issue is mentioned briefly has me perplexed.

I've also tried explicitly listing the event:

<Triggers><asp:AsyncPostBackTrigger ControlID="gdvPendingReview" EventName="PageIndexChanging" /></Triggers>

As I continue to test this, it becomes more frustrating and fascinating. I have created two new pages with only the gridview, linqdatasource, scriptmanager, and databinding methods. One page has no master....the other page has a master (but a completely new and clean one to avoid any possible interference). Same results! Paging/Sorting works great asynchronously as long as I'm not using a master page. :(

Thanks all!

AsyncFileUpload1.Enabled = true not functioning well

$
0
0

I have few controls in a update panel and I had set all the controls enabled=false when Page_Load. I have one button to set all the controls enabled=true when onclick. There is a problem with one of the control which is AsyncFileUpload. First click all the controls was enabled except AsyncFileUpload. AsyncFileUpload only enabled if I click the same button twice. This is happen consistently. 

<form id="form1" runat="server"><div><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><cc1:AsyncFileUpload runat="server" ID="AsyncFileUpload1" /><asp:Button ID="Button1" runat="server" Text="Button" /></div></form>
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Page.IsPostBack = False Then
            Me.AsyncFileUpload1.Enabled = False
        End If

    End Sub

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Me.AsyncFileUpload1.Enabled = True
    End Sub

'navigator.appName' of ajax toolkit is said to have Browser Detection Techniques

$
0
0

Hi

We are trying to check our web application whether it meets the 'standards level' of the modernization levels.

We doubt, it is failing because of browser detection techniques as - verified fromhttp://www.modern.ie/en-us/report . The browser detection type is shown 'navigator.appName', which is present in the ajax toolkit used.

Could somebody help us in overcoming this problem?

Teja

 

JavaScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts

$
0
0

I am looking to install the Ajax tool kit. I was able download the sample from codeplex.

And following instructions, I was able to launch + try the sample site included in the zip file. 

I am using vs2013 and running everything local on my computer (using vs2013 built in web server to test + try this).

I thus used the AjaxControlTookitBinary.NET45 version.

 

I am able to run the sample website from vs2013. And if I create a new project + web site and COPY the WHOLE sample web site into that folder (overwriting everything), then again I find the tool kit works. 

And the steps to add the controls to the tool box also seems to have worked fine.

 

I now created a new site from vs2013 (FILE- new site). 

If create a blank page and drop in the ToolScriptManager as the FIRST step, then I now have this:

 

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default2.aspx.vb" Inherits="Default2" %>

<%@ 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>

    <p>

        Hello

    </p>

    </form>

</body>

</html>

 

When I attempt to run this page with F5, I get this message:

 

unhandled exception at line 22, column 5 inhttp://localhost:55267/ScriptResource.axd?d=Hm 

PHS4c8DJOsyehLgTYT9GMvdLZ_65LcQvbOT-Hs4aNkbWXOPg5hTei9LqAL9F7bHjxmNugEAxceCOtkOKzRBaWjUZdaSa4CnjO6dBNPyh1cqPFCXFtwQWSzIwb-K25j0&t=ffffffffda74082d

0x800a139e - JavaScript runtime error: 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.

How does one go about adding the 4.0 Ajax scripts to new web sites? Are these scripts to be copied from the original sample site and then placed in the scripts folder, or are these a set of scripts I need to reference during development?

 

I am having much difficulty resolving this. Some suggest to change the tag prefix to something other then asp for the TookKitScriptMananger?. I tried using cc1 as per this example and no change: 

http://forums.asp.net/t/1506194.aspx

Does anyone have a step by step on how to place + use the ToolScriptManager onto a page and then resolve the missing 4.0 scripts error I receive above? I just upgraded to vs2013 and I having a real struggle (loved vs2010!!!).

 I as a last resort copied the Bin folder from the sample download into the bin folder for this site and + added the references to AjaxControlToolkit.dll in that bin folder.  This did not help. 

Any help on this mystery problem is appreciated.

 

Best regards,

Albert D. Kallal (Access MVP)

Edmonton, Alberta Canada

 

Call to .axd returns 404

$
0
0

I created my own .axd handler for uploading file and set everyting in the web.config.

when I call the .axd, I get 404.

I have another .axd which works fine on the same web application.

in httpHandlers I have:

<add verb="GET" path="ShowImage.axd" validate="false" type="ImageServer.StreamImage, ImageServer"/><add verb="POST" path="UploadFileServer.axd" validate="false" type="UploadFileServer.UploadFile, UploadFileServer"/>



in handlers (for iis7) I have:

<add name="ImageServer" preCondition="integratedMode" path="ShowImage.axd" verb="GET" type="ImageServer.StreamImage, ImageServer"/><add name="UploadFileServer" preCondition="integratedMode" path="UploadFileServer.axd" verb="POST" type="UploadFileServer.UploadFile, UploadFileServer"/>



ShowImage.axd works fine, UploadFileServer returns 404.

why?

Ajax controls are disable in IE

$
0
0

Hi everyone,

I am new to web developing. Been working on a project for about 4 months or so to be used inhouse at the company I work for.

I am using WEb express 2012 for my development.

I created a intranet website using the ajax toolkit controls such as the calendar extendar, shadow extender, collapsiblePanel ext. etc.

When developing the wesite I have no issues running in IE9/10/11. When I imported the application to a windows 7 (64bit) machine running IIS7 the controls using those extendars are not working.

They seem to be disabled. In Fixrefox and  Chrome they work as expected.

In IE 9 I was able to get the controls(extenders) to work after I disabled the interanet zone settings.

Is this a bug or is there something I am missing?

Thanks

Ajax controlls (CalendarExtender & ComboBox) not working after deploying

$
0
0

My computer: Windows 7 with VS 2010 Pro installed & AjaxControlToolkit 4.1.7.1005 installed.

Destination: Windows 2008 R2.

 The controlls work fine on my local box.  But when I deploy them, they don't work at all. I get the following when I run it (once it does come up):

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.1; WOW64; Trident/5.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; .NET4.0C; .NET4.0E; MS-RTC EA 2; InfoPath.3; MS-RTC LM 8)
Timestamp: Tue, 24 Dec 2013 00:36:46 UTC


Message: Object doesn't support this action
Line: 2
Char: 44750
Code: 0
URI: http://thirdpartyorderentry/ScriptResource.axd?d=1-9x5UbSbEDSHOTL1CMF_jUgvGYRDU5eDU75xU4plAwG7zDtYpoa4azgEka-TPR-ucTbNUbprnKo80WX91U0u-t8KPlD5RG7H5iRkDEEwdQbY3tyGXzkiRd2rM0S8Qyo0&t=153abac5

My web.config:

<?xml version="1.0" encoding="utf-8"?>
<!--
For more information on how to configure your ASP.NET application, please visit
http://go.microsoft.com/fwlink/?LinkId=169433
-->
<configuration>
<connectionStrings>Not connecting directly to any databases.
</connectionStrings>
<system.web>
<customErrors mode="Off"/>
<compilation debug="true" targetFramework="4.0">
<assemblies>
<add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A" />
<add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
<add assembly="System.Core, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
</assemblies>
</compilation>
<authentication mode="Forms">
<forms loginUrl="~/Account/Login.aspx" timeout="2880" />
</authentication>
<membership>
<providers>
<clear />
<add name="AspNetSqlMembershipProvider" type="System.Web.Security.SqlMembershipProvider" connectionStringName="ApplicationServices" enablePasswordRetrieval="false" enablePasswordReset="true" requiresQuestionAndAnswer="false" requiresUniqueEmail="false" maxInvalidPasswordAttempts="5" minRequiredPasswordLength="6" minRequiredNonalphanumericCharacters="0" passwordAttemptWindow="10" applicationName="/" />
</providers>
</membership>
<profile>
<providers>
<clear />
<add name="AspNetSqlProfileProvider" type="System.Web.Profile.SqlProfileProvider" connectionStringName="ApplicationServices" applicationName="/" />
</providers>
</profile>
<roleManager enabled="false">
<providers>
<clear />
<add name="AspNetSqlRoleProvider" type="System.Web.Security.SqlRoleProvider" connectionStringName="ApplicationServices" applicationName="/" />
<add name="AspNetWindowsTokenRoleProvider" type="System.Web.Security.WindowsTokenRoleProvider" applicationName="/" />
</providers>
</roleManager>
<pages>
<controls>
<add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />
</controls>
</pages>
</system.web>
<system.webServer>
<handlers>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler,
System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" />
</handlers>
<modules runAllManagedModulesForAllRequests="true" />
</system.webServer>
<system.serviceModel>
<bindings>
<basicHttpBinding>
<binding name="MuscleAndFitnessSoap" />
</basicHttpBinding>
</bindings>
<client>
  I use web services, but I don't think they're relevant to this.
</client>
</system.serviceModel>
<runtime>
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
<dependentAssembly>
<assemblyIdentity name="AjaxMin" publicKeyToken="21ef50ce11b5d80f" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-5.3.5068.16458" newVersion="5.3.5068.16458" />
</dependentAssembly>
</assemblyBinding>
</runtime>
</configuration>

My aspx page:

<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
CodeBehind="EnterOrder.aspx.cs" Inherits="ThirdPartyOrderEntry.DataEntry.EnterOrder" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
<link href="../Styles/StyleSheet.css" rel="stylesheet" type="text/css" />
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server">
<Services>
<asp:ServiceReference Path="http://thirdpartyorderentry/OrderEntryWebService/MuscleAndFitness.asmx" />
</Services>
</ajaxToolkit:ToolkitScriptManager>
<%--<asp:DropDownList ID="ddlItems" runat="server" />--%>
<div class="row">
<%--<div class="label"><asp:Label ID="lblCustKey" runat="server">Customer Key:</asp:Label></div><div class="value"><asp:TextBox ID="txtCustKey" runat="server" /></div>--%>
<div class="label">
<asp:Label ID="lblCustName" runat="server">Customer Name:</asp:Label></div>
<div class="value">
<asp:TextBox ID="txtCustName" runat="server" ValidationGroup="Validation1" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*" ValidationGroup="Validation1" ControlToValidate="txtCustName" ForeColor="Red" />
</div>
<div class="label">
<asp:Label ID="lblPromiseDate" Text="Promise Date:" runat="server" />
</div>
<div class="value">
<asp:TextBox ID="txtPromiseDate" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender TargetControlID="txtPromiseDate" ID="CalPromiseDate" runat="server"/>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator7" runat="server" ErrorMessage="*" ValidationGroup="Validation1" ControlToValidate="txtPromiseDate" ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<div class="label">
<asp:Label ID="lblRequestedDate" Text="Requested Date:" runat="server" />
</div>
<div class="value">
<asp:TextBox ID="txtRequestDate" runat="server"></asp:TextBox>
<ajaxToolkit:CalendarExtender TargetControlID="txtRequestDate" ID="CalendarExtender1" runat="server"/>
<asp:RequiredFieldValidator
ID="RequiredFieldValidator8" runat="server" ErrorMessage="*" ValidationGroup="Validation1" ControlToValidate="txtRequestDate" ForeColor="Red"></asp:RequiredFieldValidator>
</div>

<%--<div class="label">
<asp:Label ID="lblContact" runat="server">Contact:</asp:Label></div>
<div class="value">
<asp:TextBox ID="txtContact" runat="server" /></div>--%>
</div>
<div class="row">
<div class="label">
<asp:Label ID="lblAddr" runat="server">Address:</asp:Label></div>
<div class="value">
<asp:TextBox ID="txtAddress1" runat="server" ValidationGroup="Validation1"/><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="*" ValidationGroup="Validation1" ControlToValidate="txtAddress1" ForeColor="Red" /><br />
<asp:TextBox ID="txtAddress2" runat="server" />
<%--<asp:TextBox ID="txtAddress" runat="server" Height="75" TextMode="MultiLine" Width="150" />--%></div>
<div class="label">
<asp:Label ID="lblCity" runat="server">City:</asp:Label>
</div>
<div class="value">
<asp:TextBox id="txtCity" runat="server" ValidationGroup="Validation1"/><asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="*" ValidationGroup="Validation1" ControlToValidate="txtCity" ForeColor="Red" />
</div>
<%--<div class="label"><asp:Label ID="lblShipVia" runat="server">ShipVia:</asp:Label></div><div class="value"><asp:TextBox ID="txtShipVia" runat="server" /></div>--%>
<div class="label">
<asp:Label ID="lblState" runat="server">State:</asp:Label>
</div>
<div class="value">
<asp:DropDownList ID="ddlState" runat="server">
<asp:ListItem Text="--Select a State--" Value="" Selected="True" />
You probably don't want to see a list of states.
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="*" ValidationGroup="Validation1" ControlToValidate="ddlState" ForeColor="Red" InitialValue="0" />
</div>
<div class="label">
<asp:Label ID="lblError" runat="server" /></div>
<div class="label">
<asp:Button ID="btnStartOrder" runat="server" Text="Begin Order"
ValidationGroup="Validation1" onclick="btnStartOrder_Click" />
</div>
</div>
<div class="row">
<div class="label">&nbsp;</div>
<div class="value">
<asp:TextBox ID="txtAddress3" runat="server" />
</div>
<div class="label">
<asp:Label ID="lblZip" Text="Zip/Postal Code:" runat="server" />
</div>
<div class="value">
<asp:TextBox ID="txtZip" runat="server" ValidationGroup="Validation1"/><asp:RequiredFieldValidator
ID="RequiredFieldValidator5" runat="server" ErrorMessage="*" ValidationGroup="Validation1" ControlToValidate="txtZip" ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<div class="label">
<asp:Label ID="lblPONum" Text="PO#:" runat="server" /><asp:Label ID="lblCustID" runat="server" />
</div>
<div class="value">
<asp:TextBox ID="txtPONum" runat="server" ValidationGroup="Validation1" MaxLength="15"/><asp:RequiredFieldValidator
ID="RequiredFieldValidator6" runat="server" ErrorMessage="*" ValidationGroup="Validation1" ControlToValidate="txtPONum" ForeColor="Red"></asp:RequiredFieldValidator>
</div>
<div class="label">
<asp:Label ID="lblSalesPersonLabel" runat="server">Salesperson:</asp:Label>
</div>
<div class="value">
<asp:Label ID="lblSalesPerson" runat="server" />
</div>
</div>
<div class="row">
<div class="label">&nbsp;</div>
<div class="value">
<asp:TextBox ID="txtAddress4" runat="server" />
</div>
<div class="label">Comments:</div>
<div class="value">
<asp:TextBox ID="txtComments" runat="server" Columns="50" />
</div>
</div>
<asp:HiddenField ID="hfOrderID" runat="server" />
<asp:GridView
ID="gvOrder"
runat="server"
Width="100%"
AutoGenerateColumns="false"
AutoGenerateSelectButton="false"
ShowFooter="true"
OnRowDataBound="gvOrder_OnRowDataBound"
OnRowCommand ="gvOrder_OnRowCommand"
OnRowDeleting="gvOrder_OnRowDeleting"
OnRowEditing="gvOrder_OnRowEditing"
OnRowCancelingEdit="gvOrder_OnRowCancelingEdit"
OnRowUpdating="gvOrder_OnRowUpdating"
DataKeyNames="RowKey">
<Columns>
<asp:CommandField CausesValidation="true" ShowEditButton="true" ShowDeleteButton="true"
ShowCancelButton="true" />
<asp:TemplateField HeaderText="Item">
<ItemTemplate>
<asp:Label ID="lblItemID" runat="server" Text='<% #Bind("ItemID") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:HiddenField ID="hfItemID" runat="server" Value='<% #Bind("ItemID") %>' />
<ajaxToolkit:ComboBox ID="ddlItem" runat="server" AutoCompleteMode="SuggestAppend" AutoPostBack="false" CausesValidation="false" />
<%--<asp:DropDownList ID="ddlItem" runat="server" AutoPostBack="false" CausesValidation="false" />--%>
</EditItemTemplate>
<FooterTemplate>
<ajaxToolkit:ComboBox ID="ddlItem" runat="server" AutoCompleteMode="SuggestAppend" AutoPostBack="false" CausesValidation="false" />
<%--<asp:DropDownList ID="ddlItem" runat="server" AutoPostBack="false" CausesValidation="false" />--%>
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Description">
<ItemTemplate>
<asp:Label ID="lblDescription" runat="server" Text='<% #Bind("ShortDesc") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:Label ID="lblDescription" runat="server" Text='<% #Bind("ShortDesc") %>' />
</EditItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Qty">
<ItemTemplate>
<asp:Label ID="lblQty" runat="server" Text='<% #Bind("Qty") %>' />
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtQty" runat="server" Text='<% #Bind("Qty") %>' />
<asp:RequiredFieldValidator ControlToValidate="txtQty" Enabled="false" ValidationGroup="Line" ErrorMessage="*" ForeColor="Red" runat="server" />
</EditItemTemplate>
<FooterTemplate>
<asp:TextBox ID="txtQty" runat="server" Text='<% #Bind("Qty") %>' />
</FooterTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Qty on Hand">
<ItemTemplate>
<asp:Label ID="lblQOH" runat="server" Text='<% #Bind("QOH") %>' />
</ItemTemplate>
</asp:TemplateField>
<%--<asp:BoundField HeaderText="Description" DataField="ShortDesc" ReadOnly="true" />--%>

<asp:TemplateField>
<FooterTemplate>
<asp:Button Text="Add" runat="server" CommandName="add" />
</FooterTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
<asp:Button Text="Complete and Ship" runat="server" OnClientClick="return confirm('Are you sure you want to submit and process this order?');" OnClick="btnSubmit_Click" ID="btnSubmit" Visible="false" />
</div>
</asp:Content>


AJAX cascading dropdown not populating - 500 error

$
0
0

NOTE: I asked this question on social.msdn.microsoft.com and was instructed to ask the question here instead.

I have two dropdown controls in a web form and I would like for the results of the second to be dependent upon the value chosen in the first, hence CascadingDropDown AJAX control.

When the page loads I click the first dropdown and get a [Method Error 500].  I have looked at every forum and article I can find and nothing suggested seems to resolve my problem.  I can't even get data into the first dropdown, much less a cascading effect. 

If I attempt to debug and go directly to the ASMX in my browser the GetClients method returns all clients if I enter blank values for both knownCategoryValues and category.

If I attempt to debug and go directly to the ASMX in my browser the GetFileTypesForClient method returns an XML string ArrayOfCascadingDropDownNameValue with no child nodes.

The AJAX controls are registered in web.config.  

When I debug the ASMX method CascadingDropDownNameValue the kv variable contains no items so I have commented it out and figured that I would play with that later.  It does throw the ArgumentException.

Please have a look and see if you can find any stupid mistakes I may have made.

Thanks!

EnterTransaction.aspx

<asp:SqlDataSource runat="server" ID="dsClients" ConnectionString="<%$ ConnectionStrings:INTP1 %>" SelectCommand="SELECT DisplayName, DBName, DisplayName + ' (' + DBName + ')' AS DisplayText, ID FROM DataOperations.dbo.vwClientDatabases ORDER BY DisplayName + ' (' + DBName + ')'" /><asp:SqlDataSource runat="server" ID="dsClientFiles" ConnectionString="<%$ ConnectionStrings:INTP1 %>" SelectCommand="SELECT cf.ClientFileID, cf.DBLIstID, db.DisplayName + ' - ' + clft.LocalFileTypeName AS DisplayText FROM DataOperations.DET.ClientFile AS cf JOIN DataOperations.DET.ClientLocalFileType AS clft ON cf.DBListID = clft.DBListID AND cf.ClientLocalFileTypeID = clft.LocalFileTypeID join DataOperations.dbo.vwClientDatabases db on db.ID = cf.DBListID ORDER BY db.DisplayName + ' (' + db.DBName + ')', LocalFileTypeName" /><asp:SqlDataSource runat="server" ID="dsTransactions" ConnectionString="<%$ ConnectionStrings:INTP1 %>" SelectCommand="SELECT * FROM DataOperations.DET.FileTransaction" /><asp:Table runat="server" ID="tblForm"><asp:TableRow runat="server"><asp:TableCell runat="server" >Client</asp:TableCell><asp:TableCell runat="server" ><asp:DropDownList runat="server" ID="ddlClients" /> <%-- DataSourceID="dsClients" DataValueField="ID" DataTextField="DisplayText" --%><ajaxToolkit:CascadingDropDown ID="cddClients" runat="server"
                     ServicePath="~/ClientFileTypes.cs.asmx" ServiceMethod="GetClients"
                     TargetControlID="ddlClients" Category="Client"
                     PromptText="Select Client..." /></asp:TableCell></asp:TableRow><asp:TableRow runat="server"><asp:TableCell runat="server" >Client File</asp:TableCell><asp:TableCell runat="server" ><asp:DropDownList runat="server" ID="ddlClientFiles" /> <%-- DataSourceID="dsClientFiles" DataValueField="ClientFileID" DataTextField="DisplayText" --%><ajaxToolkit:CascadingDropDown ID="cddClientFiles" runat="server"
                     ServicePath="ClientFileTypes.cs.asmx" ServiceMethod="GetFileTypesForClient"
                     TargetControlID="ddlClientFiles" ParentControlID="ddlClients" LoadingText="Loading..."
                     Category="Client"
                     PromptText="Select File Type..." /></asp:TableCell></asp:TableRow><asp:TableRow runat="server"><asp:TableCell runat="server" >Load Date</asp:TableCell><asp:TableCell runat="server" ><asp:Button runat="server" ID="btnSubmit" Text="Add File Transaction" OnClick="btnSubmit_Click" /></asp:TableCell></asp:TableRow></asp:Table>

ClientFileTypes.asmx.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Services;
using System.Configuration;
using System.Web.Script.Services;
using AjaxControlToolkit;
using System.Web.Services.Protocols;
using System.Collections.Specialized;
using System.Data.SqlClient;

namespace DETTracker
{
    /// <summary>
    /// Summary description for ClientFileTypes
    /// </summary>
    [WebService(Namespace = "http://tempuri.org/")]
    [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    [System.ComponentModel.ToolboxItem(false)]
    // To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line. 
    [System.Web.Script.Services.ScriptService]
    public class ClientFileTypes : System.Web.Services.WebService
    {
        [WebMethod]
        public CascadingDropDownNameValue[] GetClients(string knownCategoryValues,
            string category)
        {
             SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["INTP1"].ConnectionString);
             sqlConn.Open();
             SqlCommand sqlCmd = new SqlCommand("SELECT DisplayName, DBName, DisplayName + ' (' + DBName + ')' AS DisplayText, ID FROM DataOperations.dbo.vwClientDatabases ORDER BY DisplayName + ' (' + DBName + ')'", sqlConn);
             SqlDataReader dr = sqlCmd.ExecuteReader();
             List<CascadingDropDownNameValue> l = new List<CascadingDropDownNameValue>();
             while (dr.Read())
             {
                l.Add(new CascadingDropDownNameValue(dr["DisplayText"].ToString(),
                dr["ID"].ToString()));
             }
            sqlConn.Close();

             return l.ToArray();
        }

        [WebMethod]
        public CascadingDropDownNameValue[] GetFileTypesForClient(string knownCategoryValues,
            string category)
        {
            int nDBListID = -1;
            //StringDictionary kv = CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues);

            //if (!kv.ContainsKey("Client") || !Int32.TryParse(kv["Client"], out nDBListID))
            //{
            //    throw new ArgumentException("Couldn't find vendor.");
            //};

            bool bReturn = Int32.TryParse(knownCategoryValues, out nDBListID);
            
            SqlConnection sqlConn = new SqlConnection(ConfigurationManager.ConnectionStrings["INTP1"].ConnectionString);
            sqlConn.Open();
            SqlCommand sqlCmd = new SqlCommand("SELECT cf.ClientFileID, cf.DBLIstID, db.DisplayName + ' - ' + clft.LocalFileTypeName AS DisplayText FROM DataOperations.DET.ClientFile AS cf JOIN DataOperations.DET.ClientLocalFileType AS clft ON cf.DBListID = clft.DBListID AND cf.ClientLocalFileTypeID = clft.LocalFileTypeID JOIN DataOperations.dbo.vwClientDatabases db on db.ID = cf.DBListID WHERE db.ID = @DBListID ORDER BY db.DisplayName + ' (' + db.DBName + ')', LocalFileTypeName", sqlConn);
            sqlCmd.Parameters.AddWithValue("@DBListID", nDBListID);
            SqlDataReader dr = sqlCmd.ExecuteReader();
            List<CascadingDropDownNameValue> l = new List<CascadingDropDownNameValue>();
            while (dr.Read())
            {
                l.Add(new CascadingDropDownNameValue(dr["DisplayText"].ToString(),
                dr["ClientFileID"].ToString()));
            }

            sqlConn.Close();

            return l.ToArray();
        }
    }
}

Unobtrusive jQuery and AJAX

$
0
0

Hello!
I have this page:

@using System.Web.Mvc.Html
@using System.Web.Optimization
@model Lab5.EPAM.WebUI.Models.RegisterUserViewModel

@{
    ViewBag.Title = "Register";
    Layout = "~/Views/Shared/_Layout.cshtml";
}<h2>Register</h2>


@using (Html.BeginForm("Register", "Account", FormMethod.Post, new { id = "form" }))
{
    @Html.AntiForgeryToken()<div class="form-horizontal"><hr />
        @Html.ValidationSummary(true)<div class="form-group">
            @Html.LabelFor(model => model.UserName, new { @class = "control-label col-md-2" })<div class="col-md-10">
                @Html.EditorFor(model => model.UserName)
                @Html.ValidationMessageFor(model => model.UserName)</div></div><div class="form-group">
            @Html.LabelFor(model => model.Password, new { @class = "control-label col-md-2" })<div class="col-md-10">
                @Html.EditorFor(model => model.Password)
                @Html.ValidationMessageFor(model => model.Password)</div></div><div class="form-group">
            @Html.LabelFor(model => model.Email, new { @class = "control-label col-md-2", width = 100 })<div class="col-md-10">
                @Html.EditorFor(model => model.Email)
                @Html.ValidationMessageFor(model => model.Email)</div></div><div class="form-group">
            @Html.LabelFor(model => model.Male, new { @class = "control-label col-md-2" })<div class="col-md-10">
                @Html.EditorFor(model => model.Male)
                @Html.ValidationMessageFor(model => model.Male)</div></div><div class="form-group"><div class="col-md-offset-2 col-md-10"><input type="submit" value="Register" class="btn btn-default" /></div></div></div>
}<div>
    @Html.ActionLink("Log in", "Login")</div>

@section Scripts {
    @Scripts.Render("~/bundles/jqueryval")<script>
        $("#form").on("submit", function (event) {
            event.preventDefault();
            if ($("#form").validate()) {
                $.post("/register", $("#form").serialize(), function () {
                    window.location.href = '@Url.Action("Login")';
                });
            }
        })</script>
}

But when I press button and my fields is empty, I can see for a millisecond Error messages of unobtrusive near fields, but I am redirecting on "Login" page always.
How can I fix it?

TabPanel

$
0
0

Hi,

I have used new ajaxtoolkit 3.5.7.725.While testing I have that my ajax tab panel is rendering as achor not span so its is overwriting achor css on my panel.

Please help me.

How to display a animated GIF image before loading a page

$
0
0

Hi all,

 I am a newbie in .NET but i was able to code simple web applications. I want to know how I can display a animated GIF image before loading a page. Any help will deeply appreciated. I've been trying to do it using AJAX extension tool but none of it seems to work.. so I wanted to do it on a div tag using javascript.

displaying progress bar on exporting data from excel

$
0
0

i am exporting data from excel. what i need is that to show a progess bar while exporting the data from excelsheet.  Also there should be no. displayed as the total no. of rows in the excel sheet to the currrent row no. being exported i.e like 2 of 50 when row no. 2 is being exported and as such the value should increase as the rows being exported progresses like 3 of 50, 4 of 50, 5 of 50 and when its 50 of 50 the progress bar should complete.  Can anyone help ? 

Viewing all 5678 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>