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

JSON string not returning to jquery

$
0
0

I have this following json values being generated dynamically through a web method

[{"AuditoriumName":"XYZ","BookingStartDate":"26-06-2018 00:00:00","BookingEndDate":"26-06-2018 00:00:00","Id":null},{"AuditoriumName":"ABC","BookingStartDate":"27-06-2018 00:00:00","BookingEndDate":"27-06-2018 00:00:00","Id":null}]

but these values are not being passed to JQUERY..

events: function (start, end, callback) {
$.ajax({
type: "POST",
url: "ajaxpg.aspx/TestOnWebService",

success: function (data) {

var events = [];

var obj = $.parseJSON(data.d);              // this is showing error




$(obj.event).each(function () {
events.push({
title: $(this).attr('AuditoriumName'),
start: $(this).attr('BookingStartDate'),
end: $(this).attr('BookingEndDate'),
// id: $(this).attr('id')
});
});
//callback(events);
callback && callback(events);


},
error: function(xhr, status, error) {
alert(xhr.responseText + "iam in error");
}


how to make textchanged event works when textbox place in update panel?

$
0
0

Dear All Experts,

Good day.

I have a textboxt which I set the autopostback to true. And when there is textchanged in the textbox, the textchanged event will fire and execute as per the codes i wrote.
It works well when i debug, however the autopostback make the webpage refresh each time the textchanged event is fired.

To prevent the page refresh, I move the textbox into a update panel. I found the textchanged event is not firing after I move the textbox into updatepanel.

What should i do to make the textchanged event fire?

thanks in advance for advice.

regards
garf

How to handle nested ModalpopupExtender

$
0
0

Hi:

I meet a problem about how to handle nested modalpopupextender, 

My code snippet is as following:

<asp:Button ID="btnDummy3" runat="server" Style="visibility: hidden" /><cc3:ModalPopupExtender ID="modalPopupExtender1" runat="server"
            BehaviorID="modalPopupExtender1"
            TargetControlID="btnDummy3"
            PopupControlID="uppnlPreViewPDF"
            BackgroundCssClass="modalBackground"></cc3:ModalPopupExtender><asp:Button ID="btnDummy5" runat="server" Style="visibility: hidden" /><cc3:ModalPopupExtender ID="ModalPopupExtender2" runat="server"
            BehaviorID="modalPopupExtender2"
            TargetControlID="btnDummy5"
            PopupControlID="uppnlHandlePDF"
            BackgroundCssClass="modalBackground"></cc3:ModalPopupExtender><asp:UpdatePanel ID="uppnlPreViewPDF" runat="server" ChildrenAsTriggers="true"><ContentTemplate><asp:Panel ID="Panel1" runat="server" Width="100%">
                ....</asp:Panel></ContentTemplate></asp:UpdatePanel><asp:UpdatePanel ID="uppnlHandlePDF" runat="server" ChildrenAsTriggers="true"><ContentTemplate><div runat="server" class="container" style="position: relative; z-index: 900001 !important;"><asp:Panel ID="pnlMakeUpPDF" class="form-horizontal" role="form" runat="server" BackColor="#F2F2DC" Width="385px" Height="270px">
                 ......</asp:Panel></div></ContentTemplate></asp:UpdatePanel>

The problem is how to call these two modalpopupextender and let then show in the same time, 

I mean if I call modalPopupExtender1.show() and the call modalPopupExtender2.show(), the UI should show modalPopupExtender1

and modalPopupExtender2 below the modalPopupExtender1. 

But in fact it always only show either modalPopupExtender1 or modalPopupExtender2, even I have set z-index, 

it still not working. Is there any good method to handle that, thanks a lot.

By the way, in chrome, it indeed can show nested modalpopextenders but in IE11, it fail.

Any suggestion is highly appreciated, thanks.

500 (Internal Server Error)

$
0
0

Hi everyone. when I am running my code I got a error " Failed to load resource: the server responded with a status of 500 (Internal Server Error)" I am using two tables one is Order and OrderDetails, there are relationship between them.

This is my index javascript code:

<script>
$(document).ready(function () {
$("#ordenTrabajo").DataTable({
"ajax": {
"url": "/Home/GetData",
"type": "GET",
"datatype": "json"

},
"columns": [
{ "data": "OrderID" },
{ "data": "OT" },
{ "data": "Cliente" },
{ "data": "Tipo" },
{ "data": "NumParte" },
{ "data": "FechaIni" },
{ "data": "FechaFin" },

]

});

});
$.fn.dataTable.ext.errMode = 'throw';
</script>

This is my Control code:

public class HomeController : Controller
{
// GET: Home
public ActionResult Index()
{
return View();
}

public JsonResult GetData()
{
InselDBEntities1 dc = new InselDBEntities1();
List<Order> orderList = dc.Orders.ToList();
return Json(orderList, JsonRequestBehavior.AllowGet);
}

}

Image with more details. 

https://drive.google.com/open?id=1SPBdSNOAiwAHwtSUEvTFExJCczQdrj6Q

Please help me out!!!

Thanks. 

Update panel not working with Content-Security-Policy in webconfig

$
0
0

Hi,

I have problem with Content-Security-Policy when add this header to my web.config my ajax update panel not working I don' t know why 

I configured Content-Security-Policy  correctly, I added  everything to my project as it needed,

<add name="Content-Security-Policy" value="default-src 'self'; font-src 'self' fonts.gstatic.com; media-src 'self';script-src 'self' remote.captcha.com; form-action 'self' localhost:58844; base-uri 'self';connect-src 'self';img-src 'self';style-src 'self' fonts.googleapis.com maxcdn.bootstrapcdn.com fonts.googleapis.com;"/>

but when I load my project update panel progress start to working I don't know why

Please help me 

Thanks.

User Control Event Handler lost after postback

$
0
0

I have a web page calling the user control to get a message as additional information before saving the record, but the save event was passed correctly, but lost after the user click save in User Control as the Save button in User Control trigger a postback. I would like to know how can I add the event handler back to the User Control so that it can pass the correct event back to the web page and call the correct Save method in web page.

Web Page

    <uc:MessageForm ID="ucComment" runat="server" />

BUT

    <uc:MessageForm ID="ucComment" runat="server" OnSave="btnSaveEmployee" />

Works. But I don't want to have two <ucMessageForm> user controls in one page. 

Web Page Codebehind

    protected void btnGetEmployeeComment(object sender, EventArgs e)
    {
        ucComment.Save += this.btnSaveEmployee;
        ucComment.GetMessage(ID);
    }

    protected void btnGetClientComment(object sender, EventArgs e)
    {
        ucComment.Save += this.btnSaveClient;
        ucComment.GetMessage(ID);
    }

    protected void btnSaveEmployee(object sender, EventArgs e)
    {
         Comment = ucComment.Comment;
         //Save Employee record
    }
    protected void btnSaveClient(object sender, EventArgs e)
    {
         Comment = ucComment.Comment;
         //Save Client record
    }

AND a user control as ModalPopup

<asp:TextBoxID="txtComment"runat="server"CssClass="ModalFormMemoInput"MaxLength="8000"TextMode="MultiLine"/>
<asp:ImageButtonID="btnSave"runat="server" ImageUrl="~/Images/ButtonSave.gif"OnClick="btnSave_Click" />

User Control Code behind

    private EventHandler _save;
    public event EventHandler Save
    {
        add
        {
            _save += value;
        }
        remove
        {
            _save -= value;
        }
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        mpeMessage.Hide();
        if (_save != null)
            _save(this, e);
    }
   
    public void GetMessage(string ID)
    {
        mpeMessage.Show();
    }

Uncaught TypeError

$
0
0

Hi,

I know this question has been posted many times over the internet, but I'm unable to find something specific to get my query fixed mainly due either i'm not understanding something due to little knowledge or that's not the case for me. I'm new to ASP.NET and AJAX, and following some tutorials here.

I'm getting error as below and further below posting a code. I've matched the code from tutorial. Initially it worked but now it's not working, and my exercise doesn't work created on similar pattern.
Could someone help me out, what is happening here please?

Thanks.

jquery.datatables.js:3406 Uncaught TypeError: Cannot read property 'length' of undefined
at jquery.datatables.js:3406
at callback (jquery.datatables.js:2528)
at Object.success (jquery.datatables.js:2558)
at fire (jquery-1.10.2.js:3062)
at Object.fireWith [as resolveWith] (jquery-1.10.2.js:3174)
at done (jquery-1.10.2.js:8249)
at XMLHttpRequest.callback (jquery-1.10.2.js:8792)

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Layout.cshtml";
}<h2>Customers</h2><table id="customers" class="table table-bordered table-hover"><thead><tr><th>Customer</th><th>Membership Type</th><th>Delete</th></tr></thead><tbody></tbody></table>


@section scripts
{
    <script>$(document).ready(function () {
            var table = $("#customers").DataTable({
                ajax: {
                    url: "/api/customers",
                    datasrc: ""
                },
                columns: [
                    {
                        data: "name",
                        render: function (data, type, customer) {
                            return "<a href='/customers/edit/" + customer.Id + "'>" + customer.name + "</a>";
                        }
                    },
                    {
                        data: "membershipType.name"
                    },
                    {
                        data: "id",
                        render: function (data) {
                            return "<button class='btn-link js-delete' data-customer-id=" + data + ">Delete</button>";
                        }
                    }
                    ]
            });$("#customers").on("click", ".js-delete", function () {
                var button = $(this);

                bootbox.confirm("Are you sure you want to delete this customer?", function (result) {
                    if (result)$.ajax({
                            url: "/api/customers/" + button.attr("data-customer-id"),
                            method: "DELETE",
                            success: function () {
                                table.row(button.parents("tr")).remove().draw();
                            }
                        });
                });
            });
        });</script>
}

updateprogress display problem

$
0
0

Hi all;

The code below allows me to click on button1, go thru various commands and display progress to the updateprogress1 panel.  It then continues to automatically "click" button2.  The problem is trying to get updateprogress2 to display anything.  The routine works and gives me the final results I expect but just does not display progress.

Does anybody know how I can get the updaterogress2 panel to display?  This will eventually expand to 12 panels total.

Thanks!

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="TestCprog2.aspx.vb" Inherits="TestCprog2" %><%@ Import Namespace="System.Data"%><%@ Import Namespace="System.Data.SqlClient"%><%@ Import Namespace="System.Data.OleDb"%><%@ Import Namespace="System.Web.Configuration"%><%@ Import Namespace="System.Diagnostics"%><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><script runat="server">

    Protected Shared idList As New ArrayList()
    Protected Shared Comp As String

    Public NotInheritable Class Utils2
        ' sealed to ensure the utility class won't be inherited
        Private Sub New()
        End Sub

        Public Shared Function GetConnString() As String
            Return WebConfigurationManager.ConnectionStrings("CRAP_HOME_USE_ACCESS").ConnectionString
        End Function

    End Class

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        'Capacitors
        Comp = "Capacitors"

        Dim sqlConnection As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("conCString1").ConnectionString)
        Dim ConnString As String = Utils2.GetConnString()
        Dim querystring As String = String.Empty

        querystring = "DELETE * FROM [Capacitors]"
        Using conn As New OleDbConnection(ConnString)
            Using cmd1 As New OleDbCommand(querystring, conn)
                cmd1.CommandType = CommandType.Text
                conn.Open()
                cmd1.ExecuteNonQuery()  'delete capacitors
            End Using
            conn.Close()
        End Using

        Dim cmd As New SqlCommand
        cmd.CommandType = CommandType.Text
        cmd.Connection = sqlConnection

        ----CODE REMOVED FOR BREVITY----

        Label1.Text = Cap & " Capacitors exported at " & DateTime.Now.ToString()

    End Sub

    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        ' Introducing delay for demonstration.
        Comp = "Connectors"
        UpdatePanel2.Update()
        Dim sqlConnection As SqlConnection = New SqlConnection(ConfigurationManager.ConnectionStrings("conCString1").ConnectionString)
        Dim ConnString As String = Utils2.GetConnString()

        Dim querystring As String = String.Empty

        querystring = "DELETE * FROM [Connectors]"
        Using conn As New OleDbConnection(ConnString)
            Using cmd1 As New OleDbCommand(querystring, conn)
                cmd1.CommandType = CommandType.Text
                conn.Open()
                cmd1.ExecuteNonQuery()  'delete connectors
            End Using
            conn.Close()
        End Using

        Dim cmd As New SqlCommand
        cmd.CommandType = CommandType.Text
        cmd.Connection = sqlConnection

        ----CODE REMOVED FOR BREVITY----

        Label2.Text = Con & " Connectors exported at " & DateTime.Now.ToString()    '237 at test

    End Sub

    Private Sub Button10_Click(ByVal sender As Object, ByVal e As System.EventArgs)

    End Sub
</script><html xmlns="http://www.w3.org/1999/xhtml" ><head id="Head1" runat="server"><title></title></head><body style="width: 1446px"><form id="form1" runat="server"><div><asp:ScriptManager ID="ScriptManager1" runat="server" AsyncPostBackTimeout="0"></asp:ScriptManager><p style="font-family: 'Arial Black'; font-size: medium; font-weight: bold; font-style: normal">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Create Access copy for Home use</p><asp:Button ID="Button10" runat="server"
                        Text="Generate Home Use Database" /><asp:Button ID="Button11" runat="server" 
                        Text="Return to Main" />&nbsp;<asp:Label ID="Label12" runat="server" Text="Capacitors"></asp:Label>&nbsp;<asp:Label ID="Label13" runat="server" Text="Connectors"></asp:Label><asp:UpdatePanel ID="UpdatePanel1" runat="server" style="width:750px;" UpdateMode="Conditional"><ContentTemplate><fieldset style="width:750px;"><asp:Button ID="Button1" runat="server" Text="Export" OnClick="Button1_Click" Style="width: 56px" />&nbsp;        <asp:Label ID="Label1" runat="server" Text="Capacitors"></asp:Label>&nbsp;<div style="display: inline-block"><asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"><ProgressTemplate><script type="text/javascript">
                                    document.write("<div class='UpdateProgressBackground'></div>");</script><span class="UpdateProgressContent"
                                    style="background-color: #FFFFFF; font-weight: bold; left: 572px; height: 29px;">Capacitor export in process...<asp:Image ID="CapWaitCap" runat="server" ImageUrl="~/Images/progress.gif" /></span></ProgressTemplate></asp:UpdateProgress></div></fieldset></ContentTemplate></asp:UpdatePanel><asp:UpdatePanel ID="UpdatePanel2" runat="server" style="width:750px;" UpdateMode="Conditional"><ContentTemplate><fieldset style="width:750px;">              <asp:Button ID="Button2" runat="server" Text="Export" OnClick="Button2_Click" Style="width: 56px" />&nbsp;              <asp:Label ID="Label2" runat="server" Text="Connectors"></asp:Label>&nbsp;<div style="display: inline-block"><asp:UpdateProgress ID="UpdateProgress2" runat="server" AssociatedUpdatePanelID="UpdatePanel2"><ProgressTemplate><script type="text/javascript">
                                document.write("<div class='UpdateProgressBackground'></div>");</script><span class="UpdateProgressContent"                                    
                                    style="background-color: #FFFFFF; font-weight: bold; left: 572px; height: 29px;">Connector export in process...<asp:Image id="CapWaitCon" runat="server" ImageUrl="~/Images/progress.gif"/></span></ProgressTemplate></asp:UpdateProgress></fieldset></ContentTemplate></asp:UpdatePanel><br /> </div></form><script type="text/javascript" language="javascript">
    Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(BeginRequestHandler1);
    Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler1);

    var thebutton;
    function BeginRequestHandler1(sender, args)
    {
        thebutton = args.get_postBackElement();
        //alert(thebutton.id)
        if (thebutton.id === "Button1") $get('UpdateProgress1').style.display = 'block';
        if (thebutton.id === "Button2") $get('UpdateProgress2').style.display = 'block';
         thebutton = args.get_postBackElement();
         //alert("ID: " + thebutton.id);
         thebutton.disabled = true;
    }
    function EndRequestHandler1(sender, args)
    {
        if (thebutton.id === "Button1") $get('UpdateProgress1').style.display = 'none';
        if (thebutton.id === "Button2") $get('UpdateProgress2').style.display = 'none';
         thebutton.disabled = false;
         var str = thebutton.id;
         //alert("Str: " + str);
         if(document.getElementById("Button" + (parseInt(str.substring(6, str.length)) + 1)))
             document.getElementById("Button" + (parseInt(str.substring(6, str.length)) + 1)).click();
         //alert("Mod: " + "Button" + (parseInt(str.substring(6, str.length)) + 1));
    }</script></body></html>


client side pageLoad()

$
0
0

I have a web form and using an script manager I can have a pageLoad() function which is supposed to be called on page loads.

but only when I run it on edge and ie 11 it is raised and on other browsers it isn't.

I have lots of other js code on my page(third parties).

is the problem caused by those js files?

how can I diagnose this problem?

thanks in advance.

AJAX statement

$
0
0

Hello,

I have an AJAX statement that I have developed on another page (which works when I click on it), and I am now moving over to the "live" page, and it doesn't.

This is the Code that doesn't seem to work (IE the Function calls do not seem to be actioned)

$(document).ready(function () {
    //use STRICT javascript rules when parsing this document"use strict";

    /* Variable declaration */

some variables in here


    /* Click Listener */
    $('.welBedButton').click(function () {

        var iSelector = $(this).find('span:first');

        if (iSelector.hasClass('glyphicon glyphicon-bed')) {
            iSelector.removeClass('glyphicon glyphicon-bed')
            iSelector.addClass('glyphicon glyphicon-cloud-upload')                                  // Change BED icon to CLOUD UPLOAD icon
            this.innerHTML = this.innerHTML.replace('Send', 'Sending');                             // Change the Button Text when clicked
        }
        console.log(" button clicked. Excellent");$.ajax({
            url: wbURL,
            dataType: "xml",
            contentType: "text/xml; charset=\"utf-8\"",
            type: "POST",
            headers: '@"SOAPAction:http://A-URL/Which-works"',
            data: 'SOAP STATEMENT THAT WORKS ON ANOTHER PAGE',

            sucess: TESTXML,

            error: xmlError
        });
    });

    /* Function Declaration */

    /* activate Bootstrap tool-tip option. turned off by default */
    $(function () {$('[data-toggle="tooltip"]').tooltip();
    });


    function TESTXML(data, textStatus, jqXHR) {
        alert("got here: sucess");
        console.log("textStatus: " + textStatus);
        console.log("jqXHR: " + jqXHR.responseText);
        alert(textStatus + " " + jqXHR.responseText);
    }



    function xmlError(jqXHR, textStatus, message) {

            alert("got here: ERROR");
    }


});

if I replace

sucess: TESTXML, 
error: xmlError

with

sucess: alert("Sucess"), 
error: alert("Error")

it shows BOTH alert pop-ups.

can someone show me where I am going wrong?

Thank you

Timer and authorization challenged during postback

$
0
0

I have a site that using windows authentication and a custom role provider and is running on Azure environment.  One of my pages has a timer that will run every minute.  I have noticed this page produces a lot of 401.2 and 401.1 entries in the server logs.  When I am actively using the page and it is posting back authorization works fine and the responses come back with 200.  When I stop using the page and the ansync postback starts running every minute from the timer, for some reason authorization is challenged.  I'm not sure what to start looking at for root cause.

Here are some of the entries from the log file.  13:31:06 is my last action before I let the timer do its thing.  The timer just performs a database hit and posts back to the same page.

timecs-methodcs-uri-stemcs-usernamesc-status
13:30:49GET/ScriptResource.axdDomain\UserID200
13:30:49GET/WebResource.axdDomain\UserID200
13:30:52POST/QUE/que.aspxDomain\UserID200
13:30:52GET/Images/refresh.pngDomain\UserID200
13:30:52GET/Images/expand.pngDomain\UserID200
13:30:56POST/QUE/que.aspxDomain\UserID200
13:30:57POST/QUE/que.aspxDomain\UserID200
13:30:57POST/QUE/que.aspxDomain\UserID200
13:30:58POST/QUE/que.aspxDomain\UserID200
13:30:58GET/ScriptResource.axdDomain\UserID200
13:30:58GET/ScriptResource.axdDomain\UserID200
13:30:58GET/ScriptResource.axdDomain\UserID200
13:30:58GET/ScriptResource.axdDomain\UserID200
13:30:58GET/Images/calendar.pngDomain\UserID200
13:30:59POST/QUE/que.aspxDomain\UserID200
13:30:59GET/ScriptResource.axdDomain\UserID200
13:30:59GET/QUE/~/images/DropDown.pngDomain\UserID404
13:31:00POST/QUE/que.aspxDomain\UserID200
13:31:01POST/QUE/que.aspxDomain\UserID200
13:31:01POST/QUE/que.aspxDomain\UserID200
13:31:03POST/QUE/que.aspxDomain\UserID200
13:31:03POST/QUE/que.aspxDomain\UserID200
13:31:06POST/QUE/que.aspxDomain\UserID200
13:31:06GET/Images/collapse.pngDomain\UserID200
13:32:07POST/QUE/que.aspx401
13:32:07POST/QUE/que.aspx401
13:32:07POST/QUE/que.aspxDomain\UserID200
13:33:08POST/QUE/que.aspx401
13:33:08POST/QUE/que.aspx401
13:33:08POST/QUE/que.aspxDomain\UserID200
13:34:08POST/QUE/que.aspx401
13:34:08POST/QUE/que.aspx401
13:34:08POST/QUE/que.aspxDomain\UserID200
13:35:09POST/QUE/que.aspx401
13:35:09POST/QUE/que.aspx401
13:35:09POST/QUE/que.aspxDomain\UserID200
13:36:10POST/QUE/que.aspx401
13:36:10POST/QUE/que.aspx401
13:36:10POST/QUE/que.aspxDomain\UserID200
13:37:11POST/QUE/que.aspx401
13:37:11POST/QUE/que.aspx401
13:37:11POST/QUE/que.aspxDomain\UserID200
13:38:11POST/QUE/que.aspx401
13:38:11POST/QUE/que.aspx401
13:38:11POST/QUE/que.aspxDomain\UserID200
13:39:12POST/QUE/que.aspx401
13:39:13POST/QUE/que.aspx401
13:39:13POST/QUE/que.aspxDomain\UserID200
13:40:13POST/QUE/que.aspx401
13:40:13POST/QUE/que.aspx401
13:40:13POST/QUE/que.aspxDomain\UserID200
13:41:13POST/QUE/que.aspx401
13:41:13POST/QUE/que.aspx401
13:41:13POST/QUE/que.aspxDomain\UserID200
13:42:14POST/QUE/que.aspx401
13:42:15POST/QUE/que.aspx401
13:42:15POST/QUE/que.aspxDomain\UserID200
13:43:15POST/QUE/que.aspx401
13:43:15POST/QUE/que.aspx401
13:43:15POST/QUE/que.aspxDomain\UserID200
13:44:16POST/QUE/que.aspx401
13:44:16POST/QUE/que.aspx401
13:44:16POST/QUE/que.aspxDomain\UserID200
13:45:17POST/QUE/que.aspx401
13:45:17POST/QUE/que.aspx401
13:45:17POST/QUE/que.aspxDomain\UserID200
13:46:17POST/QUE/que.aspx401
13:46:17POST/QUE/que.aspx401
13:46:17POST/QUE/que.aspxDomain\UserID200
13:47:18POST/QUE/que.aspx401
13:47:18POST/QUE/que.aspx401
13:47:18POST/QUE/que.aspxDomain\UserID200
13:48:18POST/QUE/que.aspx401
13:48:18POST/QUE/que.aspx401
13:48:18POST/QUE/que.aspxDomain\UserID200
13:49:19POST/QUE/que.aspx401
13:49:19POST/QUE/que.aspx401
13:49:19POST/QUE/que.aspxDomain\UserID200

My cookie is the same for all entries.  The roles and session are sent over.  Cookies have 10 minute sliding expiration and Session has 30 minute sliding expiration so both are still valid when the timer starts posting back.

SMMSADIDENTITY=jEtvQXVznBU3zJegOHdpIH66mkFgMmw3/DwN4qSkkll/medDu8gJgsl+MYp2aWX34R39RMvHrP1qYAe2a6x3dPnh74Qv+ZoL0jcCVpTCniTEwa+JAf4rgcgkjSQxma10D+sQCgsK5vF6T8uqu3PdThmyIq86Y9lFBpTW85/eGNWueAMhZN+loPDeOxJtt1lTbGTHbJe6+ESq4pGOhYcyqZeb5uuvTUbFZKA/RzCaWy7AhUI9LPl4oTwif+lE+iypHYT+vSIQDmMP/Us+TFSh+Jf1sNvvRU3zLMuzJDe+f/1Jhy/3h/+1wPRkFxef8OMP31fApLfBErJz0QXhXZaxWgjfhaP+bk9+2NwY3sTx0IRpxY996BnvJ6QIIQCOfEWWHLu4QRAUIdBM9mZJnEh9Of7s+t0ALhWYQfjAEDRFaoPuzk/6uvBuMo7/aZDqwqCL5GnpvjJfCR1hQKa0NcyZDkzUoGdq/QBYZsJMENF+6Ehg/aaKyjU+gOOjwm9ib1HKcHs//jAVd3BUqSqFEPyKXNTgBCQC9zb/UDp2UF6OyuMj1EocGLuEd9fMAtIr5yFy8CRCQHXB/nVPxZ005+K3rIj3oDSy3GP4AN/MWEIssbIrtSwu3uCZxT5WTzOmdWwyY9JIT3XsoDqCIwSgW0s11YVm8uU1szT90LtUht3Bel1Fkd1VTlUuNHH38FnV1A0t;+SMMSADCHALLENGE=NTC_CHALLENGE_DONE;+ARRAffinity=2b3382e259bcded79cf2fe0b059efd2c22d485b467015b81ad8ee3ca7f1cb9a6;+ASP.NET_SessionId=csvynkt2jrouemr55zldlmpk;+.ASPROLES=AAEAAAD_____AQAAAAAAAAAMAgAAAE1TeXN0ZW0uV2ViLCBWZXJzaW9uPTQuMC4wLjAsIEN1bHR1cmU9bmV1dHJhbCwgUHVibGljS2V5VG9rZW49YjAzZjVmN2YxMWQ1MGEzYQUBAAAAIVN5c3RlbS5XZWIuU2VjdXJpdHkuUm9sZVByaW5jaXBhbAgAAAAIX1ZlcnNpb24LX0V4cGlyZURhdGUKX0lzc3VlRGF0ZQlfSWRlbnRpdHkNX1Byb3ZpZGVyTmFtZQlfVXNlcm5hbWURX0lzUm9sZUxpc3RDYWNoZWQJX0FsbFJvbGVzAAAAAgEBAAEIDQ0BAgAAAAEAAACm-Cq_aubVSKY8illp5tVICgYDAAAADFJvbGVQcm92aWRlcgYEAAAACk1TXHNsZXNlbWEBBgUAAADjA0RPQ19MT0dJQ19PV05FUixET0NfU1NJU19QS0dfT1dORVJTLFFVRV9TS0lMTFNfUVVFVUVTLFFVRV9UQUJfRklMVEVSLFJFUV9SRVAsUVVFX0ZFVENILFFVRV9UQUJfUVVFU1RJT05TLERPQ19DSE5HX09XTkVSLFFVRV9UQUJfQlVDS0VULERCUF9URUFNX1NBU1UsREJQX1RFQU1fT0ZGU0hPUkUsRE9DX0JVU19VU0VSUyxBRE0sUVVFX1RBQl9TS0lMTFMsREJQX1RFQU1fUEFJRDAxLFFVRV9DSEVDSyxRVUVfUkVQX0RFTlRBTCxRVUVfVEFCX1RFQU0sRE9DX1RBQl9BRE1JTixRVUVfVEFCX1NVUCxEQlBfVEVBTV9QQUlELERCUF9FTEdfQSxRVUVfVEFCX1FVRSxRVUVfVVNSX0RCUF9QQUlELERlbnRhbF9QSEksU1NSU19ERFNfUEhJLFFVRV9VU1JfREJQX1BFTkQsVklTU0JWRVcsUVVFX01BTixET0NfVEFCX09XTkVSUyxRVUVfUkVQX0lOVkVOVE9SWSxRVUVfVVNSLFFVRV9SRVBfTUFOQUdFUixET0NfQURNSU4sREJQX1RFQU1fT05TSE9SRSxWSVNTQkFETQs1

The web.config has the following entries. 

<system.web>

<authorization>

<allowroles ="ADM,QUE_MAN,QUE_SUP,QUE_USR" />

<denyusers ="*"/>

</authorization>

</system.web>

JSON for image upload

$
0
0

Can you tell me what wrong with my code..

[WebMethod]
[ScriptMethod]
public static void InsertWebService(check c)
{

HttpPostedFile postedFile= c.photo;             
string fileName = System.IO.Path.GetFileName(postedFile.FileName);

//Set the Image File Path.
string filePath = "~/check/" + fileName;

//Save the Image File in Folder.
postedFile.SaveAs(HttpContext.Current.Server.MapPath(filePath));

//performing normal insert query ..
Connection con = new Connection();
SqlConnection conn = new SqlConnection();
SqlCommand cmd = new SqlCommand();
conn = con.getConnection();
try
{

conn.Open();
query = ""; 

// Query written 

}//close finally

AJAX call..

student.photo = $('#photo').val(),   // I need to know if i can send the path like this.. this gives c:\fakepath\fileuploaded.jpg

//normal call to web service

can you tell what is going wrong

writing a function for document.ready

$
0
0

How to write a function that will communicate and ready the service being used with a simple message. The service is taking a while to load because it goes dormant when not being used so it has to "wake up" every time. So basically I need a function that communicates with server after document.ready to wake up, so then when the user searches for something in the service it doesn't take forever to load because it will already be loaded.  Is this on the right track? 

    function sayHello() {
        if (receiveReq.readyState == 4 || receiveReq.readyState == 0) {
            receiveReq.open("GET", 'service', true);
            receiveReq.onreadystatechange = handleSayHello;
            receiveReq.send(null);
        }
    }

Refreshing Google map under Update Panel by using Timer control

$
0
0

I have a google map on web page which I wish to refresh after every certain time of period.

In order to do that I kept google map under the UpdatePanel and place a timer control outside the update panel, set the interval 5000 mili seconds. On the Tick event of timer control I called the method which is collecting the coordinates and put on the google map and suppose it should work but it is not working.

The page refresh but the map area goes out after first refresh and never get back.

Can anyone help?

<asp:Timer ID="mapTimer" runat="server" Interval="5000"></asp:Timer><asp:UpdatePanel ID="mapPanel" runat="server" updatemode="Always" ><ContentTemplate><div id="map"></div><script>

    var map, infoWindow;
    var startLocation_lat, startLocation_lng;
    //var mapTimer = setInterval(initialize, 32000);      // Auto refresh the google map every after 10 seconds

    function initialize() {

        var coordinates = {<%=Coordinates%>};

        // Picking up the first location latitude and longitude to keep the location in center of the map

        for (var ab in coordinates) {
            for (cd = 0; cd < coordinates[ab].length; cd++) {
                if (cd == coordinates[ab].length - 1) {
                    startLocation_lat = coordinates[ab][cd][1];
                    startLocation_lng = coordinates[ab][cd][2];
                }
            }
        }

        var mapOptions = {
            zoom: <%=MapZoomValue%>,
            center: new google.maps.LatLng(startLocation_lat, startLocation_lng),
            mapTypeId: google.maps.MapTypeId.ROADMAP
        };

        var bounds = new google.maps.LatLngBounds();
        var map = new google.maps.Map(document.getElementById("map"), mapOptions);

        var myarr = [];
        for (var i in coordinates) {
            for (j = 0; j < coordinates[i].length; j++) {
                myarr.push(new google.maps.LatLng(coordinates[i][j][1], coordinates[i][j][2]));
            }

            var mypath = new google.maps.Polyline({
                path: myarr,
                strokeColor: '#FF0000',
                strokeOpacity: 0.5,
                strokeWeight: 6,
                fillColor: '#FF0000',
                fillOpacity: 0.35
            });

            mypath.setMap(map);
            myarr = [];
        }

        var image = "images/icon-car-2.png";
        //var image = "https://developers.google.com/maps/documentation/javascript/examples/full/images/beachflag.png";
        var shape = {
            coords: [1, 1, 1, 20, 18, 20, 18, 1],
            type: 'poly'
        };

        var infowindow = new google.maps.InfoWindow();
        var mouseover_text, click_text;

        for (var a in coordinates) {

            for (var b = 0; b < coordinates[a].length; b++) {

                if (b == coordinates[a].length - 1) {

                    mouseover_text = coordinates[a][b][0];
                    click_text = coordinates[a][b][3];

                    var marker = new google.maps.Marker({
                        position: { lat: coordinates[a][b][1], lng: coordinates[a][b][2] },
                        map: map,
                        icon: image,
                        shape: shape
                    });

                    google.maps.event.addListener(marker, 'click', function (event) {
                        infowindow.setContent(click_text);
                        infowindow.open(map, marker);
                    });

                    google.maps.event.addListener(marker, 'mouseover', function (event) {
                        infowindow.setContent(mouseover_text);
                        infowindow.open(map, marker);
                    });
                    marker.setMap(map);
                }
            }
        }


    }

    window.onload = initialize;

</script><script async defer src="https://maps.googleapis.com/maps/api/js?key=<map-api-key>&callback=initialize"></script></ContentTemplate> <Triggers><asp:AsyncPostBackTrigger ControlID="mapTimer" EventName="Tick" /></Triggers></asp:UpdatePanel> 

error: AjaxControlToolkit.RatingExtender missing required StarCssClass property

$
0
0

please help:

System.ArgumentException: AjaxControlToolkit.RatingExtender missing required StarCssClass property value for Rating2_RatingExtender.
Parameter name: StarCssClass..

code:

<title></title>

<style type="text/css">
.Star
body
{
font-family: Arial;
font-size: 10pt;
display: block;
background-repeat: no-repeat;
}
th, td
{
height: 30px;
width: 100px;
}
</style>
<style type="text/css">
.Star
{
background-image: url(images1/Star.gif);
height: 17px;
width: 17px;
}
.WaitingStar
{
background-image: url(images1/WaitingStar.gif);
height: 17px;
width: 17px;
}
.FilledStar
{
background-image: url(images1/FilledStar.gif);
height: 17px;
width: 17px;
Display:Block;
background-repeat:no-repeat;
}
</style>
</head>
<body>


Update panel not partially postbacking.

$
0
0

<asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><table style="text-align: center" width="960px" runat="server" id="accepttbl"><tr title="Reviewer's comment" style="width: 960px" id="txtboxreview" runat="server"><td><asp:Label ID="Labelreview" runat="server" Text="Reviewes / Comments : "></asp:Label></td><td colspan="2"><asp:TextBox ID="txtReview" runat="server" Width="425px" TextMode="MultiLine" Style="width: 800px"></asp:TextBox></td></tr><tr style="width:960px;"><td></td><td colspan="2"><asp:TextBox ID="txtrevisionmail" runat="server" Visible="false" Width="425px" Rows="7" TextMode="MultiLine" Style="width: 800px" placeholder="Please write revision mail for the principal investigator"></asp:TextBox></td></tr><tr style="width: 960px" runat="server" id="reviewaccept"><td><asp:Label ID="Label2" runat="server" Text="Accepted ? "></asp:Label></td><td><asp:DropDownList ID="ddlStatus" runat="server" OnSelectedIndexChanged="ddlStatus_SelectedIndexChanged" AutoPostBack="true"><asp:ListItem Value="0">NO</asp:ListItem><asp:ListItem Value="1" Selected="True">YES</asp:ListItem></asp:DropDownList></td><td colspan="2"><asp:Button ID="btnSubmitRevCom" runat="server" Text="Submit comment" CssClass="btn btn-primary" OnClick="btnSubmitRevCom_Click" /></td></tr><tr runat="server" id="officeremarks" visible="false"><td><asp:TextBox ID="txtoffcremark" Width="900px" runat="server" TextMode="MultiLine" Rows="5" placeholder="Office Remarks"></asp:TextBox><asp:Button ID="btnoffcremark" runat="server" Text="Submit Remarks" CssClass="btn btn-primary" OnClick="btnoffcremark_Click" /></td></tr></table></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="ddlStatus" EventName="SelectedIndexChanged"/></Triggers></asp:UpdatePanel>

Source Code :

 protected void ddlStatus_SelectedIndexChanged(object sender, EventArgs e)
    {
        User loginUser = Session["LoginUser"] as User;
        ModuleSP msp = new ModuleSP();
        if (msp.HasAdminPrivilage(loginUser.Id, IntranetModules.EgrantAdmin))
        {
            if (loginUser.EmailId != "deanacad")
            {
                if (ddlStatus.SelectedValue == "0")
                {

                    txtrevisionmail.Visible = true;
                    //Email typing box display email goes when submit button press
                }
                else
                {
                    txtrevisionmail.Visible = false;
                }
            }
        }}


AsyncFileUpload don't work

$
0
0

Hi. On my form I have AsyncFileUpload. Server responds with  - The file attached is empty. It doesn't work on one of the computers. On other computers everything is fine. I lost 2 days with this problem and I decided to ask here. Firewall and antivirus is off. Please help me. Thanks.

This http://www.ajaxtoolkit.net/AsyncFileUpload/AsyncFileUpload.aspx - so it does not work - The file attached is empty.

Update panel is not working

$
0
0

Iam working with a page i need update panel to avoid page refresh when textbox changed event fire .but when update panel is there the another textbox is not getting value of the textchanged event coding. the page using master page and some javascripts. when update panel or master page hide it is working good. 

<tr>
<td colspan="2">Actual Programme fee(₹)
</td>
<td>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>

<asp:TextBox ID="txtactualpfee" runat="server" Width="300px" AutoPostBack="true" OnTextChanged="txtactualpfee_TextChanged" ></asp:TextBox>
<asp:TextBox ID="txtdifferenc" runat="server" Width="300px" Enabled="false" placeholder="Difference in Programme fee"></asp:TextBox>

</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="txtactualpfee" EventName="TextChanged"/>
</Triggers>
</asp:UpdatePanel>
</td>

</tr>

<tr>

<td colspan="4">
<asp:GridView ID="grdtax" runat="server" Width="400px" CssClass="gridview" AutoGenerateColumns="False" DataKeyNames="taxid" ShowFooter="false" CellPadding="4" ForeColor="#333333" GridLines="none" OnRowDataBound="grdtax_RowDataBound" >

<Columns>

<asp:TemplateField >
<ItemTemplate>
<asp:Label ID="lbldesc" runat="server" Text='<%# Bind("taxdesc") %>'></asp:Label>
<asp:HiddenField ID="taxper" runat="server" Value='<%# Bind("taxper") %>' />
</ItemTemplate>


</asp:TemplateField>
<asp:TemplateField >
<ItemTemplate>
<asp:TextBox ID="txttax" runat="server"></asp:TextBox>
</ItemTemplate>


</asp:TemplateField>
</Columns>


</asp:GridView>

</td>

</tr>
<tr id="igst_tr" runat="server" visible="false">
<td colspan="2">
<asp:Label ID="l_igst" runat="server" Text="IGST @ 18%"></asp:Label></td>
<td>
<asp:TextBox ID="txtigst" runat="server" Width="300px" > </asp:TextBox></td>
</tr>
<tr>
<td colspan="2">Total Credit Note Amount (₹)
</td>
<td>
<asp:TextBox ID="txttotal" runat="server" Width="300px"></asp:TextBox>
</td>

</tr>

code behind

protected void txtactualpfee_TextChanged(object sender, EventArgs e)
{
int fee1=int.Parse(txtIprogramfee.Text);
int fee2=int.Parse(txtactualpfee.Text);
int difference = fee1-fee2;
txtdifferenc.Text = difference.ToString();

if (!chkigst.Checked)
{

DateTime date = DateTime.ParseExact(txtdate.Text, "dd-MM-yyyy", CultureInfo.InvariantCulture);
grdtax.DataSource = new academicinvoiceSP().gettaxdetails(date);
grdtax.DataBind();

}
else
{
igst_tr.Visible = true;

float igst = 18;
float actualfee = float.Parse(txtactualpfee.Text);
float taxamount = actualfee * (igst / 100);
txtigst.Text = taxamount.ToString();

txttotal.Text = (actualfee + taxamount).ToString();
}}


Updatepanel height displays differently from what shows in design mode

$
0
0

I'm using Visual Studio 2015 with SQL Server 2014, VB.

I have several updatepanels stacked one right above the other.  In design mode they show the height as 22px but when the program executes they appear to be about twice that height.  Does anybody have any ideas what can cause this to happen and how I can fix it?

A typical updatepanel code is shown below (note: in the code it shows the height as 29px, I don't understand this difference either):

<asp:UpdatePanel ID="UpdatePanel1" runat="server" style="width:750px;" UpdateMode="Conditional" ChildrenAsTriggers="false"><ContentTemplate><fieldset style="width:750px;"><asp:linkButton ID="Button1" runat="server" Text="Export" OnClick="Button1_Click" Style="width: 56px" />&nbsp;        <asp:Label ID="Label1" runat="server" Text="Capacitors"></asp:Label>&nbsp;<div style="display: inline-block"><asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanel1"><ProgressTemplate><script type="text/javascript">
                                    document.write("<div class='UpdateProgressBackground'></div>");</script><span class="UpdateProgressContent"
                                    style="background-color: #FFFFFF; font-weight: bold; left: 572px; height: 29px;">Capacitor export in process...<asp:Image ID="CapWaitCap" runat="server" ImageUrl="~/Images/progress.gif" /></span></ProgressTemplate></asp:UpdateProgress></div></fieldset></ContentTemplate><Triggers><asp:AsyncPostBackTrigger ControlID="Button1" EventName="Click"/></Triggers></asp:UpdatePanel>

Thanks!

Can't Assign Values to Textbox inside updatepanel.

$
0
0

Hi Guys,

I have panel control and inside panel control I have update panel and inside update panel I have few textboxes.  The problem is  I am not able to change the values on the Page_Load event on first page load (not post back).  

Can anyone help me out with this?

protected void Page_Load(object sender, EventArgs e)
{
  if (!IsPostBack)
  { 
      txtPW1.Text = "567890";   
      txtPW2.Text = "567890";
  }
}
<asp:Panel runat="server" ID="pnUserInfo" Width="95%" 
            GroupingText="<span class=grpTitle>Entry Information</span>"><asp:UpdatePanel ID="upUserInfo" runat="server"><ContentTemplate><table cellpadding="3" cellspacing="0" style="width: 100%"><tr><td align="right" class="tdText">
                                User ID<span style="color: #FF0000 !important">*</span></td><td align="right"><asp:TextBox ID="txtUserName" runat="server" CssClass="txtBox" onkeypress="return AllowForUserName(event);"
                                    onpaste="return false;"  MaxLength="30" AutoPostBack="True" OnTextChanged="OnUserNameChanged" Enabled="False"></asp:TextBox><%--  <asp:Image ID="imgUserAv" runat="server" ImageUrl="~/_Images/User.png" Width="20px" />--%></td><td colspan="2"><asp:Label ID="lblUserAvailStatus" runat="server" Width="85%"></asp:Label></td></tr><tr><td align="right" class="tdText" style="width: 140px">
                               Password<span style="color: #FF0000 !important">*</span></td><td align="right"><asp:TextBox ID="txtPW1" runat="server" TextMode="Password" CssClass="txtBox" onpaste="return false;"
                                     MaxLength="24"></asp:TextBox></td><td align="right" class="tdText" style="width: 140px">
                              Re-enter Password<span style="color: #FF0000 !important">*</span></td><td align="right"><asp:TextBox ID="txtPW2" runat="server" TextMode="Password" CssClass="txtBox" onpaste="return false;"
                                     MaxLength="24"></asp:TextBox></td></tr></table></ContentTemplate></asp:UpdatePanel></asp:Panel>

Viewing all 5678 articles
Browse latest View live


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