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

AsyncFileUpload does not work in Firefox 22

$
0
0

How to check whether file exist in the queue to Upload or not

$
0
0

Hi all,
I am using ajax toolkit file upload control and on click of my submit button i need to check whether the file selected by the user is uploaded or not and give a error message if not.
 
I tried a way that once the file is selected by user then upload button visibility is coming ,by that way i done that.but now i found if user select the file and removed that.at this point also the upload button is coming .So my validation got failed.
 
Now i thought of getting the queue container and loop through each and every child elements and match with the remove button in that particular div.
 
please tell me that ,what am i doing is right? and suggest me the way to achieve this.

AutoCompleteExtender - Clear textBox when result not found.

$
0
0

Hi,I have an AutoCompleteExtender, a textbox and a hiddenField on my form. What I would like to do is clear the textbox and hidden field's value if user does not select the item from the autocomplete list (or if data typed on textbox does not exists in DB). Below is the code I have got so far...

<asp:TextBoxID="txtAutoCopleteProduct"runat="server"Width="80%"></asp:TextBox>                    

<cc1:AutoCompleteExtenderID="AutoCompleteExtender1"runat="server"TargetControlID="txtAutoCopleteProduct" ServiceMethod="GetProducts"ServicePath="SFAWebService.asmx"MinimumPrefixLength="4"FirstRowSelected="true"CompletionInterval="10"CompletionSetCount="50"BehaviorID="AutoCompleteEx"    
OnClientItemSelected="OnProductSelected"DelimiterCharacters=""ShowOnlyCurrentWordInCompletionListItem="true"></cc1:AutoCompleteExtender>

  <asp:HiddenFieldID="hdnProductID"runat="server"/>

 

FunctionOnProductSelected(source, eventArgs) {          

var hdnValueID = "<%= hdnProductID.ClientID %>";

document.getElementById(hdnValueID).value - eventArgs.get_value();

_doPostBack(hdnValueID,"");

}

I think I need to clear the textbox on OnTextChanged event of textbox. Is there a way I can use any events of AutoCompleteExtender without making a trip back to database?

 

Thank you in advance for your responses.

           

Uploadify and Modalpopupextender

$
0
0

Hi

I am trying to use the Uploadify control from within a modalpopupextender, however I cannot get the javascript to recognise the input control.

 

How do I reference the inout control (or any other control for that matter) from within a modalpopupextender?

 

<script type="text/javascript">
            $(function () {
                $("#<%=file_upload_reply.ClientID%>").uploadify({
                    'swf': '../Uploadify/uploadify.swf',
                    'uploader': '../Uploadify/VBHandlerReply.ashx?accountid=<%=AccountId%>&ticketguid=<%=TicketReplyGuidId%>&ticketid=<%=TicketId%>',
                    'cancelImg': '../Uploadify/uploadify-cancel.png',
                    'buttonText': 'Select Files',
                    'multi': true,
                    'auto': true,
                    'removeCompleted': false,
                    'fileSizeLimit': '4MB'
                });
            })</script>

and the input control is as follows:

 

  

<inputtype="file"name="file_upload_reply"id="file_upload_reply"runat=server/>

UpdatePanel in EditItemTemplate of Gridview causing full page refresh

$
0
0

Hi,

I tried to search for solutions, but couldn't find any. Everywhere they are talking about Gridview within UpdatePanel. In my case I have an UpdatePanel within the EditItemTemplate of a Gridview and a DropDownList in that EditItemTemplate is causing postback on SelectChange event. I just want that cell or at most that row of the gridview to be partially rendered, but the whole page flashes.

I have used an update panel elsewhere on that page, but outside the gridview and it is working fine.

Is UpdatePanel not supported within Gridview templates?

Thanks!

Browser refresh problem with ModalPopupExtender

$
0
0

I am using the ModalPopupExtender to add/edit data. It works fine but the problem is that after hiding the modal,if i hit the browser refresh button, the modal appears again (as it did when I clicked on add/edit button). I am using the following code:

<div class="dataentry"><asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:GridView
                                    ID="gvSchool"
                                    runat="server"
                                    DataKeyNames="SchoolID"
                                    AutoGenerateColumns="False"
                                    CellPadding="6" ShowFooter="True"><Columns><asp:TemplateField ShowHeader="True" HeaderText="Edit"<ItemTemplate><asp:ImageButton ID="btnEdit" runat="server" CausesValidation="False" CommandName="EditData"
                                                    ImageUrl="edit.png" ToolTip="Edit record" /></ItemTemplate></asp:TemplateField><asp:BoundField HeaderText="School" DataField="SchoolName" /></Columns></asp:GridView></ContentTemplate></asp:UpdatePanel><asp:Panel
                            ID="pnlAddEdit"
                            runat="server"
                            style="display:none; background-image:url('dialogtitle.jpg');"
                            Height="140px"
                            Width="300px"><span class="paneltitle">School Details</span><asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional"><ContentTemplate><asp:Button ID="btnShowPopup" runat="server" Style="display: none" /><asp:ModalPopupExtender
                                        ID="ModalPopupExtender1"
                                        PopupControlID="pnlAddEdit"
                                        BackgroundCssClass="modalBackground"
                                        TargetControlID="btnShowPopup"
                                        runat="server"></asp:ModalPopupExtender><table style="background-color:White; " align="center"><tr><td style="text-align:right;"><spanSchool: </span></td><td style="text-align:left;"><asp:TextBox ID="txtSchool"runat="server"></asp:TextBox><asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="*"
                                                    ControlToValidate="txtSchool" /></td></tr><tr><td colspan="2"></td></tr><tr><td style="text-align:right;"></td><td style="text-align:right;"><asp:ImageButton ID="btnSave" ImageUrl="save.jpg" runat="server" Text="Save" OnClick="btnSave_Click"  />&nbsp;<asp:ImageButton ID="btnUpdate" ImageUrl="update.jpg"runat="server" Text="Update" OnClick="btnUpdate_Click"  />&nbsp;<asp:ImageButton ImageUrl="cancel.jpg" ID="btnCancel" runat="server" Text="Cancel" /></td></tr></table></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="btnSave" EventName="Click" /><asp:AsyncPostBackTrigger ControlID="btnCancel" EventName="Click" /></Triggers></asp:UpdatePanel></asp:Panel></div>

The code-behind code is as follows: 

    protected void btnSave_Click (object sender, EventArgs e)
    {
        try
        {
            // save school result

            // display some user message

            // clear out controls;


            gvSchool.DataSource = // get all schools
            gvSchool.DataBind();
            UpdatePanel1.Update ();

        }
        catch (Exception ex)
        { 
             //display error
        }
    }

 

I looked at the sample found here: http://www.ajaxcontroltoolkit.com/ModalPopup/ModalPopup.aspx and that does not load the modal popup on browser refresh. Is there a way to hide the modal popup on browser refresh? Am I missing something?

Any help is appreciated.

AJAX is server side, What about client side validation?

$
0
0

Am new to AJAX and Javascript. ScriptManager seems to control them both.

The ASP.NET 4.0 by Wrox I'm working out of recommends putting this in master page:

<% Master Language="VB %>

<Script runat="server">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>

    <asp:ContentPlaceHolder ID="head" runat="server">
    </asp:ContentPlaceHolder>
</head>
<body class="bodyclass">
    <form id="form1" runat="server">

<div>

<asp:ScriptManager ID="ScriptManager1" runat="server"/>

<asp:ContentPlaceHolder ID="ContentPlaceholder1" runat="server">

    </asp:ContentPlaceHolder>

</div>

Questions:

1. With that, will all the scripts(Javascript or AJAX) I register for any page derived from master run the server?

2. I want easy-to-code, quick-running client side validation to complement my slow, certain-to-work server side validation. How to achieve and still run Ajax?

3. AJAX all runs on server side, and is faster than a whole postback, I understand. Still can I call Client-Side Javascript(or JQuery or whatever) from code-behind file? Is such a thing possible or does all code-behind runat server? 

Edit/Delete option in HoverMenuExtender is not pointing to the particular row

$
0
0

Hi,

Please help me with this problem. Attached code below.

<asp:Panel ID="pnlModifyData" CssClass="saplePanel" runat="server" Style="display: none"><div style="float: right"><asp:ImageButton ID="imgbtnClosePopup" runat="server" ImageUrl="~/Images/White_Close.png" /></div><div style="margin: 5% 15% 10% 15%"><asp:GridView ID="gvData" OnRowDataBound="gvData_RowCreated" OnRowCreated="gvData_RowCreated" Style="text-align: center" runat="server" DataSourceID="sqlDSModifyData"><Columns><asp:TemplateField HeaderStyle-Width="0px"><ItemTemplate><asp:Panel ID="popupMenu" runat="server" Style="display:none"><div style="border: 1px outset white; padding: 2px;"><div><asp:LinkButton ID="lnkButtonEdit" runat="server" CommandName="Edit" Text="Edit" /></div><div><asp:LinkButton ID="lnkButtonDelete" runat="server" CommandName="Delete" Text="Delete" /></div></div></asp:Panel><asp:Panel ID="pnl9" runat="server"><table width="100%"><tr><td width="auto"><asp:Label ID="lblSlno" runat="server" Text='<%#Eval("Margin_Slno") %>' /></td><td width="auto"><asp:Label ID="lblDate" runat="server" Text='<%#Eval("Margin_Date") %>' /></td><td width="auto"><asp:Label ID="lblProjectID" runat="server" Text='<%#Eval("Margin_ProjectID") %>' /></td><td width="auto"><asp:Label ID="lblProductCode" runat="server" Text='<%#Eval("Margin_ProductCode") %>' /></td><td width="auto"><asp:Label ID="lblMargin" runat="server" Text='<%#Eval("Margin_ExpMargin") %>' /></td></tr></table></asp:Panel><Ajax:HoverMenuExtender ID="hoverMenu" runat="server"
                                PopupControlID="popupMenu"
                                PopupPosition="Right"
                                HoverCssClass="popupHover"
                                TargetControlID="pnl9"
                                PopDelay="25" /></ItemTemplate><EditItemTemplate><asp:Panel ID="popupMenu" runat="server"><div style="border: 1px outset white; padding: 2px;"><div><asp:LinkButton ID="lnkButtonUpdate" runat="server" CommandName="Update" Text="Update" /></div><div><asp:LinkButton ID="lnkButtonCancel" runat="server" CommandName="Cancel" Text="Cancel" /></div></div></asp:Panel><Ajax:HoverMenuExtender ID="hoverMenu" runat="server" PopupControlID="popupMenu"
                                PopupPosition="Left" HoverCssClass="popupHover" TargetControlID="popupMenu"
                                PopDelay="50" /></EditItemTemplate></asp:TemplateField></Columns></asp:GridView></div></asp:Panel><Ajax:ModalPopupExtender ID="mpeModifyData" runat="server" BackgroundCssClass="sample"
        TargetControlID="imgbtnModify" CancelControlID="imgbtnClosePopup" PopupControlID="pnlModifyData"></Ajax:ModalPopupExtender><asp:SqlDataSource ID="sqlDSModifyData" runat="server" ConnectionString="<%$ ConnectionStrings:VLConnectionString %>"
        SelectCommand="SELECT * FROM [Velan].[dbo].[Margin]"></asp:SqlDataSource><Ajax:RoundedCornersExtender ID="rceModifyData" runat="server" TargetControlID="pnlModifyData"
        Corners="All" Radius="10"></Ajax:RoundedCornersExtender>

Here, I am showing a ModalPopup on click of a button that displays a gridView which takes data from a datasource.

The problem is that when ever I point to a particular row "The position of the Edit/Delete is fixed to the top right corner.

Can someone help me to make the buttons display to the right of the particular row in gridView?

Thanks in advance

-Sai




asynchronous postback interfering with button click events

$
0
0

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest is causing a button click event not to fire.

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string enableOnTimeoutScript ="<script type='text/javascript'>Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(" +"function (sender, args) { if (args.get_error()) { ";

                int buttonIndex = 0;

                foreach (Button button in allButtons)
                {
                    enableOnTimeoutScript +=
                        string.Format("var button{0} = document.getElementById('{1}'); " +"if (button{0} != null) button{0}.disabled = true; ", buttonIndex++, button.ClientID);
                }

                enableOnTimeoutScript +=
                    string.Format("var validator0 = document.getElementById('{0}'); " +"if (validator0 != null) {{ validator0.style.visibility = 'visible'; " +"validator0.innerHTML = args.get_error().message; }} ", customValidator.ClientID);

                enableOnTimeoutScript += "args.set_errorHandled(true); } });</script>";

                Literal enableOnTimeoutLiteral = new Literal();
                enableOnTimeoutLiteral.Text = enableOnTimeoutScript;

                panelDocumentNav.Controls.Add(enableOnTimeoutLiteral);
            }
                
            Button saveData = new Button();
            saveData.EnableViewState = true;
            saveData.Click += new EventHandler(dynamicButton_Click);
            saveData.Text = "SAVE";
      }

 <asp:Content ID="contentBody" ContentPlaceHolderID="contentPlaceHolderBody" runat="server"><div style="height: 100%; left: 0px; position: absolute; top: 0px; width: 76%;"></div><asp:Panel ID="panelDocumentNav" runat="server" CssClass="panel" Width="24%" Style="height: 100%;
        position: absolute; right: 0px; top: 0px;"><div class="spacer" style="overflow: auto; height: 100%"><asp:PlaceHolder runat="server" ID="dynamicControls"></asp:PlaceHolder></div><asp:UpdatePanel ID="updatePanelQ" runat="server"><ContentTemplate><div><asp:CustomValidator ID="customValidator" runat="server" CssClass="error" /></div></ContentTemplate></asp:UpdatePanel>


When the page is first loaded and the SAVE button is clicked the dynamicButton_Click event is not fired but a post back occurs b/c the Page_Load method is called but the if (!IsPostBack) is false so code within if statement is not executed.  The page is reloaded.  If I click the button again the dynamicButtonClick event is fired.

If I comment out the code in the if (!IsPostBack) the dynamicButton_Click event is fired on the first click.

Why is the event not being fired on the first click?

verify execution of javascript in asp.net c#

$
0
0

Hello.I havea web application that hasajaxcomponents,theserestrictmultiple characters. But when in the browsersecurityoption"Automation- activescriting"is disabled,theajaxcomponetesnot work.HowI cancheck ifthe user's browserhasenabledthe execution ofscripts(iejavascript)?
Thank you very much.

AjaxControlToolKit not found issue

$
0
0

Split off from http://forums.asp.net/t/1519956.aspx/1?AjaxControlToolKit+not+found+issue. Please don't necropost

hii,

I m using .NET Framework 4.0 and still I was unable to solve the problem. 

I had modified the web.config file as you shown above and I had added :

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %>

on every page where I had used Ajax.

Now I m not getting any errors, but the ajax contents are not shown on the page. other than ajax contents are shown on the page.

Please Help me in this regard.

Thanks in advance

How run query if any of the text boxes have value

$
0
0

hi

Suppose I have three text boxes One is for user name, second for profile name and third one is for date of birth.

All I want to run query if one or more text boxes have value.

For example if profile name text box is filled then query should have where caluse with value of profile name text box. 

Ofcourse there can be two textboxes filled like user name and date of birth text boxes have values then query should run on the basis of both text boxes.

Index was out of range.

$
0
0

hey all

when i try to select command the following error comes in my code

ERROR

Index was out of range. Must be non-negative and less than the size of the collection. Parameter name: index

CODE

protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
        {
            if (e.CommandName == "Delete")
            {
                DepartmentSupervisorInfo.DeleteDeptSupervisor(Convert.ToInt32(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2].Text));
                GridView1.DataSource = DepartmentSupervisorInfo.getDeptSupervisor();
                GridView1.DataBind();
            }
            else if (e.CommandName == "Select")
            {
                DataSet ds = DepartmentSupervisorInfo.getDeptSupervisorbyID(Convert.ToInt32(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2].Text));
                Hdnfld_deptsupid.Value = ds.Tables[0].Rows[0]["DepartmentSupervisorID"].ToString();
                Dd_supDepid.DataValueField = ds.Tables[0].Rows[0]["DepartmentID"].ToString();
                dd_supEmpid.DataValueField = ds.Tables[0].Rows[0]["EmployeeID"].ToString();
           }
        }


ERROR IN THIS LINE

                DataSet ds = DepartmentSupervisorInfo.getDeptSupervisorbyID(Convert.ToInt32(GridView1.Rows[Convert.ToInt32(e.CommandArgument)].Cells[2].Text));



cannot find table 0 in login form

$
0
0

hey all
 
i have 1 login form for 2 users one is admin and second is simple user
 
when i login from theri password then its fine and working but when ienter worng password it gives me error CANNOT FIND TABLE 0
 
CODE
 

public int Loginuser1(string UserName, string Password)
        {
            // return the values if Admin then 1 else 2 for User
           int a = Convert.ToInt32( db.ExecuteDataSet("splogin3", new object[] { UserName, Password }).Tables[0].Rows[0][0].ToString());
           return a;
        }

AND login button code is

protected void Button1_Click(object sender, EventArgs e)
        {
            if (cd.Loginuser1(UserName.Text, Password.Text)==1)
            {
                Session["UserID2"] = cd.Loginuser1(UserName.Text, Password.Text);
                Session["Login4"] = UserName.Text;
                Session["Login5"] = Password.Text;
                Lgin.Text = ("Login Successfully");
                Response.Redirect("DocUpload.aspx");

 
                Lgin.Text = ("Incorrect Passsword");
            }
 
            else if (cd.Loginuser1(UserName.Text, Password.Text)==2)
            {
                Session["UserID"] = cd.Loginuser1(UserName.Text, Password.Text);
                Session["Login2"] = UserName.Text;
                Session["Login3"] = Password.Text;
                Lgin.Text = ("Login Successfully");
                Response.Redirect("InfoDoc.aspx");
 
                Lgin.Text = ("Incorrect Passsword");
            }
        }



Could not load file or assembly 'AjaxMin, Version=4.97.4951.28478

$
0
0

I run Visual studio 2010 and 2012.

I have the ajax control toolkit installed on both. Version 3.5.x in 2010, and the latest version in 2012.

I have a project that I am working on in visual studio 2010.

I have been trying to get some ajax controls working in the site, in the case here in, a password strength component.

when I try to run the page I get the error:

Could not load file or assembly 'AjaxMin, Version=4.97.4951.28478, Culture=neutral, PublicKeyToken=21ef50ce11b5d80f' or one of its dependencies. The system cannot find the file specified.

I am not running Ajax version 4.x in THIS site, here it should be 3.5. In the web application properties page I see a reference to AjaxControlToolkit .NET 3.5.7.725

I assume that since installing the newer version of Ajax in vs 2012, something in 2010 is 'confused'.

Does anyone have an idea how to correct this issue.


in ajax

$
0
0

Hi, when my controls into updatepanel:

<asp:UpdatePanel ID="UpdatePanel2" runat="server"><ContentTemplate><br /><asp:TextBox ID="TextBox2" runat="server" Height="124px" TextMode="MultiLine"></asp:TextBox><asp:Button ID="Button2" runat="server" Text="Button" /></ContentTemplate></asp:UpdatePanel>

this code not work:

cmd1.Parameters.Add(New SqlParameter("@key1", TextBox2.Text.Replace(Environment.NewLine, "<br/>")))

<br/> tag not insert to database, how i do?


Image upload and Store in database using ajax file upload

$
0
0

Hey everyone !

i am making a website where i need that the user should upload his photo(the one like facebook, where cropping and rest can be done)

for his profile picture.

since i dont know what to code for it. but my problem is that 

i want the image to be stored into my database (image path in database and image in my server folder)

what should i code for it in C# to store the image path in database and image in folder while using AJAX File Upload(Since it gives option for drag and drop and multiple file uploads)

and i also want to show the uploaded photo in a image box

please help ? 

Good technique for a ajax for asp dot net?

$
0
0

Hi currently we are using Telerik contols for our web site application. i want to replace telerik rad ajax manager by normal update panel.

What are the best way to achive ajax in ASP dot net?  is there any other way to do the same with update panel? 

Does your directory structure matter for Ajax Toolkit to work?

$
0
0

Within the root of directory of my website I have created a Application Folder that I am building my .net application in. I have all my .net folders in my application folder, Bin, App_Code, etc. The Ajax ToolKit is installed in the Bin folder and registered in the web.config file. When I add a ModalPopupExtender or any other ToolKit control on my page .net does recognize it. However when I go to test in a browser the functionality does not work. I have tested the same page code in the root site of another application and it works. Is there something that needs to be done because I do not have the .net folders in the root of the site?

Thanks in advance for your help

IE 10 Issue: SCRIPT5022: Sys.ArgumentOutOfRangeException: Value must be an integer. Parameter name: x

$
0
0

My asp.net site is running well on IE6, IE7, IE8, IE9, Chrome, Safari, Firefox and Opera. But it is not working in IE10.

If I click on the Grid in the site it returns the following error:

SCRIPT5022: Sys.ArgumentOutOfRangeException: Value must be an integer.
Parameter name: x
Actual value was 956.5.
ScriptResource.axd, line 2810 character 12

Followed all the possible solutions found on the google but sill problem exists. Followed solutions are

http://stackoverflow.com/questions/14046857/javascript-error-in-every-page-on-ie-10
http://social.msdn.microsoft.com/Forums/en/netfxjscript/thread/e8cb8041-2e23-4a20-9c2e-825832b8f3f0


Can anyone please help me to resolve this?

Thanks in advance!

Viewing all 5678 articles
Browse latest View live




Latest Images