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

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;
                }
            }
        }}



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>

ASP.NET MVC + AJAX

$
0
0

Hi,

I'm working app with phonegap using MVC Controller & AJAX and i have problem with my login page,which i cant Login :(

This what i have in my Controller :

 [Route("Login/{Mail}/{pass}")]
        [HttpPost]
        public JsonResult Login(string Mail, string pass)
        {
            var hashedPass = PasswordSecurity.PasswordStorage.CreateHash(pass);
            using (DataContext db = new DataContext())
            {
                var query = from cbr in db.Contact_Business_Relation
                            join c in db.Contact on cbr.Contact_No_ equals c.Company_No_

                            join sa in db.Sales_Header on cbr.No_ equals sa.Sell_to_Customer_No_
                            join px in db.PX2 on c.E_Mail equals px.Email_ID

                            where c.E_Mail == Mail.ToLower()
                            select new
                            {
                                Mail = c.E_Mail,
                                pass = px.PS,
                             
                            };

                var user = query.FirstOrDefault();
                var CheckPass = PasswordSecurity.PasswordStorage.VerifyPassword(pass, user.pass);

                if (user != null && CheckPass)
                {
                    Session["Email"] = user.Mail.ToString();
                }

                return Json(user, JsonRequestBehavior.AllowGet);
            }

and this what i have in my Login.html:

<form id="loginForm" class="login100-form validate-form"><span class="login100-form-title">
                        Login</span><div class="wrap-input100 validate-input" data-validate="Valid email is required: ex@abc.xyz"><input class="input100" type="text" name="Mail" id="logEmail" placeholder="Email"><span class="focus-input100"></span><span class="symbol-input100"><i class="fa fa-envelope" aria-hidden="true"></i></span></div><div class="wrap-input100 validate-input" data-validate="Password is required"><input class="input100" type="password" name="pass" id="logPassword" placeholder="Password"><span class="focus-input100"></span><span class="symbol-input100"><i class="fa fa-lock" aria-hidden="true"></i></span></div><div class="container-login100-form-btn"><button id="login" class="login100-form-btn">
                            Login</button></div><div id="msg"></div>

and this my Ajax function:

<script type="text/javascript">$(document).ready(function () {$("#login").click(function () {$("#msg").html("Logging in...");
            var data = {"Mail": $("#logEmail").val(),"pass": $("#logPassword").val(), 
                };$.ajax({
                url: "http://xxxx/Account/Login/" + data.Mail + '/' + data.pass,
                type: "POST",
                data: JSON.stringify(data),
                success: function (status) {$("#msg").html(status.msg);
                    if (status.Success)
                    {
                        window.location.href = "Program/ProgramList";
                    }

                },
                failure: function (status) {
                    alert(status.responseText);
                }, //End of AJAX failure function
                error: function (status) {
                    alert(status.responseText);
                } 
            });
        });
    });
</script>

did i miss something ? when i try login i get alert undefined

Can anyone please point me in right direction?!

thanks

How to detect preview print event in Chrome

$
0
0

Hi:

I have a problem about how to detect the event of afterprint in chrome. 

The following is my code snippet:

protected void btnView_Chrome(object sender, EventArgs e)
{
	string s = string.Empty;
	s += "var doc = oWin.document; doc.write(" + "\"";
	s += "<iframe src=" + PDFfilePath + " style='height:0; display: none;' onload=\\\"this.contentWindow.print();\\\"></iframe>\"";
	s += ");";
	s += "oWin.setTimeout(\"document.getElementsByTagName(\\\"BODY\\\")[0].addEventListener(\\\"afterprint\\\", function(){console.log(\\\"1000\\\");}());\",3000);oNewWin.blur(); this.blur();" + "</script>"; ;
	string f = string.Empty;
	f = @"<script language='javascript'>
		oWin = window.open('','','width=0,height=0,top=0,left=0,toolbar=no,resizable=no,scrollbars=no,status=no');";
	f += s;
	string strOpenNew = f;
	ScriptManager.RegisterStartupScript(this.btnPrint, this.GetType(), "PrintItem", strOpenNew, false);
}

The code can run but can't detect the afterprint event in chrome, instead, it will 

be execute all instructions at init stage.  I also try another methods, like:

s += "oNewWin.setTimeout(\"console.log(\\\"teseting!!!\\\"); console.log(\\\"teseting2!!!\\\");window.onafterprint = function(){console.log(\\\"teseting3!!!\\\");}();\",10000);oNewWin.blur(); this.blur();";

But they all fail, the only way can work is following:

https://www.w3schools.com/tags/tryit.asp?filename=tryhtml5_ev_onafterprint

But I don't know how to declare that in doc.write, is there good suggestion for that, 

Thanks a lot.

#datepicker Odd behavior in different browsers

$
0
0

<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">

$(function () { $("#datepicker").datepicker(); $("#anim").on("change", function () { $("#datepicker").datepicker("option", "showAnim", $(this).val()); }); });

When this is rendered in chrome the datepicker looks as specified in Jquery reference. When it is rendered in Edge I get this odd calendar picker..... Works OK but my question is why are they rendered differently in the 2 browsers?

Edge Calendar

Return to View after ajax post to controller

$
0
0

Hi All,

I'm trying post data from View to controller and then return back to view. This is my script in view 

<script type="text/javascript">$(document).ready(function () { $("Submit").click(function (e) {
            e.preventDefault();

            var token = $('input[name=__RequestVerificationToken]').val();
            console.log(token);

            var dataToPost = $(this).serialize();$.ajax({
                url: "Process/Payment"
                , method: "POST"
                , data: {
                    __RequestVerificationToken: token
                    , page: dataToPost
                }
                , done: function (data) {window.location.replace (data.newUrl);
                    alert(data);
                }
                , error: function () {
                    alert("Ajax call failed");

                }
            })
        })
    })
</script>

and this is my controller. All data that wrap in 'Payment' model is in good shape. And, I want to return back to view (url: "Process/Payment")

        public ActionResult Payment(Payment payment) {
            return Json(new {
                                newUrl = Url.Action("Payment", "Process") //Payment as Action; Process as Controller
                            }
                        );
        }

but when the page return to localhost, I just get thisHow should I do to return the page that look like before hit submit button as POST ?

why "window.location.replace ()" can't redirect page to the original page ?

Thx's

#datepicker Odd behavior in different browsers

$
0
0

<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/base/jquery-ui.css">
<link rel="stylesheet" href="//code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" href="/resources/demos/style.css">

$(function () { $("#datepicker").datepicker(); $("#anim").on("change", function () { $("#datepicker").datepicker("option", "showAnim", $(this).val()); }); });

When this is rendered in chrome the datepicker looks as specified in Jquery reference. When it is rendered in Edge I get this odd calendar picker..... Works OK but my question is why are they rendered differently in the 2 browsers?

Edge Calendar

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> 


SlideShow method error

$
0
0

I am trying to use the SlideShowExtender in toolkit and I get the following error.

An unhandled exception occurred:

Message: Unknown web method GetSlides.

Parameter name: methodName

 

 Stack Trace:

  at System.Web.Script.Services.WebServiceData.GetMethodData(String methodName)

  at System.Web.Script.Services.RestHandler.CreateHandler(WebServiceData webServiceData, String methodName)

  at System.Web.Script.Services.ScriptHandlerFactory.GetHandler(HttpContext context, String requestType, String url, String pathTranslated)

  at System.Web.HttpApplication.MaterializeHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()

  at System.Web.HttpApplication.ExecuteStepImpl(IExecutionStep step)

  at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)

Below is my markup and webmethod 

<asp:Image ID="ImgSlide" runat="server" Height="300" Width="300" /><ajaxToolkit:SlideShowExtender ID="SlideShowExtender1" runat="server" 
                    TargetControlID="ImgSlide" 
                    SlideShowServiceMethod="GetSlides" 
                    SlideShowServicePath="~/WebServiceImages.asmx" 
                    AutoPlay="True" 
                    PlayInterval="1000" />

Imports System.IO
Imports AjaxControlToolkit
Imports System.Web.Services

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()><WebService(Namespace:="http://tempuri.org/")><WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)><Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()>
Public Class WebServiceImages
    Inherits System.Web.Services.WebService<WebMethod()>
    Public Shared Function GetSlides() As Slide()
        Dim slides As New List(Of Slide)()
        Dim sPath As String = HttpContext.Current.Server.MapPath("~/ketodocs/slides/")
        If sPath.EndsWith("\") Then
            sPath = sPath.Remove(sPath.Length - 1)
        End If
        Dim pathUri As New Uri(sPath, UriKind.Absolute)
        Dim files As String() = Directory.GetFiles(sPath)
        For Each file As String In files
            Dim filePathUri As New Uri(file, UriKind.Absolute)
            slides.Add(New Slide() With {
              .Name = Path.GetFileNameWithoutExtension(file),
              .Description = Path.GetFileNameWithoutExtension(file) + " Description.",
              .ImagePath = pathUri.MakeRelativeUri(filePathUri).ToString()
        })
        Next
        Return slides.ToArray()
    End Function

End Class

Ajax not working on somee.com as in visual

$
0
0

i create a modal login.it do good when i debug with chorme ,but when i upload to somee.com it not woking as in visual

input search list throwing a stack overflow error

$
0
0

I want a text box on the form, which acts like a search box. when i start typing the roll numbers, it should automatically fill it up.

this text box in bind with a query which fetches around 400 roll nos from the database.

<label> Type the Registration Number</label>
<input list="rollnos" autocomplete="off" type="search" id="f" class="form-control" runat="server" onload="getStudentWise" ><span id="errmsg"></span>
<datalist id="rollnos" runat="server" > </datalist>

Below is the code in code behind.

If the query is for top 200 or something below 200 rollnos,it works fine.

but  the query is "select regdno from student_master where college_code='GIMSR' and status='S'    // this should fetch around 450 records.

the above query automatically gives a stack overflow exception error.. 

string query = "select top 250 regdno from STUDENT_MASTER where COLLEGE_CODE='GIMSR' and status='S' order by regdno";
cmd = new SqlCommand(query, conn);
rs = new SqlDataAdapter(cmd);
ds = new DataSet();
rs.Fill(ds);
table1 = ds.Tables[0];


for (int i = 0; i < table1.Rows.Count; i++)
builder.Append(String.Format("<option value='{0}'>", table1.Rows[i][0]));


rollnos.InnerHtml = builder.ToString();
f.Attributes["list"] = rollnos.ClientID;

can any one help me

CalendarExtender Problems

$
0
0

I have an issue where when I click on the field with the CalendarExtender, it brings up a list of dates with the calendar behind it.  It only was happening on one computer for over a year (no problem - just work around it), but now it's happening on more computers and I haven't changed any code.  Any ideas of why this is happening or what I should look at?  Only happens when you click in field - it's okay when you tab to field.  I was thinking it was a Windows 10 issue, but now it's happening on a Windows 7 computer.  I've been searching and I can't find anything.  Thanks in advance!

How to load data from database to ajax and get values back on front end by asp.net?

$
0
0

string constr = "Server = 192.168.248.212; Database = testdb; Trusted_Connection = True;";
int i;

i = 0;
SqlConnection con = new SqlConnection(constr);
SqlCommand cmd = new System.Data.SqlClient.SqlCommand();
cmd.CommandText = "select * from LoE";
cmd.Connection = con;
con.Open();
SqlDataReader reader = cmd.ExecuteReader();


con.Close();

bind gridview on checkbox check without postback

$
0
0

im trying to generate a second gridview based on the rows i select from the first gridview , i am selecting them by checkbox .

actualy its working , but everytime i check the page is postinb back then the gridview is generated. I need to be able to do that without posting back to the server

below is my code :

aspx:

<asp:GridView CssClass="myGridClass" ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="PublicationIssueID"
 OnRowEditing="OnRowEditing" OnRowCancelingEdit="OnRowCancelingEdit" 
OnRowUpdating="OnRowUpdating" OnRowDeleting="OnRowDeleting" 
                 OnRowDataBound = "OnRowDataBound" OnSelectedIndexChanged = "OnSelectedIndexChanged" ><Columns><asp:TemplateField HeaderText="Choose"><ItemTemplate><asp:CheckBox ID="chkRow" runat="server" OnCheckedChanged="GetSelectedRecords"  /></ItemTemplate></asp:TemplateField><asp:TemplateField  HeaderText="ISSUE NUMBER" ItemStyle-Width="50"><ItemTemplate><asp:Label ID="Number" runat="server" Text='<%# Eval("IssueNumber") %>'></asp:Label></ItemTemplate><EditItemTemplate><asp:TextBox ID="Number" runat="server" Text='<%# Eval("IssueNumber") %>'></asp:TextBox></EditItemTemplate>

aspx.cs

protected void GetSelectedRecords(object sender, EventArgs e)
    {


        DataTable dt = new DataTable();
        dt.Columns.AddRange(new DataColumn[2] { new DataColumn("IssueSubjectType"), new DataColumn("IssueSubject") });
        foreach (GridViewRow row in GridView1.Rows)
        {
            if (row.RowType == DataControlRowType.DataRow)
            {
                CheckBox chkRow = (row.Cells[0].FindControl("chkRow") as CheckBox);
                if (chkRow.Checked)
                {
                    string IssueSubjectType = (row.Cells[3].FindControl("IssueSubjectType") as Label).Text;
                    string IssueSubject = (row.Cells[4].FindControl("IssueSubject") as Label).Text;
                    dt.Rows.Add(IssueSubjectType, IssueSubject);
                }
            }
        }


        if (dt.Rows.Count == 0)
        {
            ButtonWord.Visible = false;
            gvSelected.Visible = false;

        }
        else
        {

            

            gvSelected.Visible = true;
            ButtonWord.Visible = true;
            gvSelected.DataSource = dt;
            gvSelected.DataBind();
        }   
    }

Any help please ? working example based on my code ? 

RadToolTipManager, dynamic tooltip issue.

$
0
0

I have used Telerik controls with asp.net in my project . I am facing a problem with displaying Tooltip. In order to display tooltip, I have used Telerik RadToolTipManager control in .net pages and in RadToolTipManager  - "OnClientBeforeShow" event, calling the bellow given javascript funtion. It working fine for  resolution like "1366 x 768",  but if i change the resolution, Tooltip is breaking. I need to have dynamic tooltip  which will resize according to data it is populated. And please suggest how to adjust font size of text in a Tooltip.

functionOnClientBeforeShow(sender, args){
    setTimeout(function(){var active =Telerik.Web.UI.RadToolTip.getCurrent();var browserWidth =$telerik.$(window).width();var browserHeight =$telerik.$(window).height();var width =(Math.ceil(browserWidth *50/100));
       active.set_width(width);
       active.get_popupElement().style.width = width +"px";},0);}

Any suggestions will be helpful, but need to use RadToolTipManager.

Thanks.


Using Timer and Update Panel to update a label

$
0
0

Hi

I appreciate your help with this. I am creating a very simple aspx page with 1 label and 1 button. I am trying to update the label every 200 ms by adding 1 to the previous value. when I run the program the label stops at 1:

PublicClassWebForm1InheritsSystem.Web.UI.PageProtectedSubPage_Load(ByVal sender AsObject,ByVal e AsSystem.EventArgs)HandlesMe.LoadEndSubDim c =0ProtectedSubTimer1_Tick(sender AsObject, e AsEventArgs)HandlesTimer1.Tick

        c = c +1Label1.Text= cEndSubProtectedSubButton1_Click(sender AsObject, e AsEventArgs)HandlesButton1.ClickTimer1.Interval=200Timer1.Enabled=TrueEndSubEndClass
<%@ Page Language="vb" AutoEventWireup="false" CodeBehind="WebForm1.aspx.vb" Inherits="WebApplication13.WebForm1" %><!DOCTYPE html><htmlxmlns="http://www.w3.org/1999/xhtml"><headrunat="server"><title></title></head><body><formid="form1"runat="server"><asp:ScriptManagerID="ScriptManager1"runat="server"></asp:ScriptManager><asp:UpdatePanelID="UpdatePanel2"runat="server">
<Triggers>
<asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" />
</Triggers>
<ContentTemplate><div></div><asp:LabelID="Label1"runat="server"Text="Label"></asp:Label><asp:ButtonID="Button1"runat="server"Text="Button"/></ContentTemplate></asp:UpdatePanel><asp:TimerID="Timer1"runat="server"></asp:Timer></form></body></html>

Can you please tell me what I am doing wrong?

Cheers

</div> </div>

AJAX Timer control working on Localhost but not on server

$
0
0

Reference Page: https://www.raefkobeissi.com/bb/index2.aspx
I would like first to thank:mgebhard and Brando ZWZfor helping me so far with another thread regarding Timer Control. I managed to make a label incrementally update every tick by using Shared variables. It worked perfectly fine on my localhost ( Using Visual Studio 2017 Community) but unfortunately when I uploaded my test project to the server it just didn't work!

Note: The server I am using is hosted by smarterasp.net, I've created many aspx pages in the past and they all worked fine. I asked them if their server support AJAX and they said yes. 

In Summary:

HTML Page including the script:

<script runat="server">
    Shared C = 0
    Protected Sub Button1_Click(sender As Object, e As EventArgs)
        Timer1.Interval = 1000
        Timer1.Enabled = True
    End Sub

    Protected Sub Timer1_Tick(sender As Object, e As EventArgs)
       c=c+1
        Label1.Text = c
    End Sub</script><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>New Page 1</title></head><body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server"><Triggers><asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /></Triggers><ContentTemplate><div style="position: absolute; width: 622px; height: 365px; z-index: 1; left: 758px; top: 99px" id="layer1"><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -153px; top: 271px" id="layer6">&nbsp;</div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -154px; top: 205px" id="layer5">&nbsp;</div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -154px; top: 135px" id="layer4">&nbsp;</div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -155px; top: 72px" id="layer3">&nbsp;<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -156px; top: 11px" id="layer2">&nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div><p>&nbsp;</div></ContentTemplate></asp:UpdatePanel><asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick"></asp:Timer></form></body></html>

Web.config File: 

<?xml version="1.0" encoding="utf-8"?><!--
  For more information on how to configure your ASP.NET application, please visit
  https://go.microsoft.com/fwlink/?LinkId=169433
  --><configuration><system.web><compilation strict="false" explicit="true" targetFramework="4.6.1" /><httpRuntime targetFramework="4.6.1" /></system.web><system.codedom><compilers><compiler language="c#;cs;csharp" extension=".cs" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.CSharpCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:1659;1699;1701" /><compiler language="vb;vbs;visualbasic;vbscript" extension=".vb" type="Microsoft.CodeDom.Providers.DotNetCompilerPlatform.VBCodeProvider, Microsoft.CodeDom.Providers.DotNetCompilerPlatform, Version=1.0.7.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" warningLevel="4" compilerOptions="/langversion:default /nowarn:41008 /define:_MYTYPE=\&quot;Web\&quot; /optionInfer+" /></compilers></system.codedom></configuration><!--ProjectGuid: 1C5EE324-242B-41FF-BCA9-9833993836F4-->

I honestly am not sure what have I done wrong! On my localhost it is working perfectly fine! no errors!

Debugging from browser under CONSOLE:
Failed to load resource: the server responded with a status of 404 (Not Found)
ScriptResource.axd:1 Failed to load resource: the server responded with a status of 404 (Not Found)
ScriptResource.axd:1 Failed to load resource: the server responded with a status of 404 (Not Found)
ScriptResource.axd:1 Failed to load resource: the server responded with a status of 404 (Not Found)
ScriptResource.axd:1 Failed to load resource: the server responded with a status of 404 (Not Found)
index2.aspx:48 Uncaught ReferenceError: Sys is not defined
at index2.aspx:48
index2.aspx:80 Uncaught ReferenceError: Sys is not defined
at index2.aspx:80

gridview command filed button not firing inside update panel

$
0
0

im trying to fire an event on button click inside gridview , im using updatepanel , but nothing is fired . below is my code .

aspx:

<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager><div><asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Always"><ContentTemplate><div><asp:Label ID="theid" runat="server" Visible="false"></asp:Label><asp:Label ID="txpath" runat ="server" Visible="false"></asp:Label><asp:GridView CssClass="myGridClass" ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="id"
 OnRowEditing="OnRowEditing" OnRowCancelingEdit="OnRowCancelingEdit" 
OnRowDeleting="OnRowDeleting" 
                 OnRowDataBound = "OnRowDataBound" OnSelectedIndexChanged = "OnSelectedIndexChanged" OnRowCommand="GridView1_RowCommand" ><Columns><asp:TemplateField HeaderText="Choose"><ItemTemplate><asp:CheckBox ID="chkRow" runat="server" OnCheckedChanged="GetSelectedRecords"   /></ItemTemplate><ItemStyle Width="20px"></ItemStyle></asp:TemplateField><asp:TemplateField  HeaderText="File Name" ItemStyle-Width="50"><ItemTemplate><asp:Label ID="Number" runat="server" Text='<%# Eval("Name") %>'></asp:Label></ItemTemplate><EditItemTemplate><asp:TextBox ID="Number" runat="server" Text='<%# Eval("Name") %>'></asp:TextBox></EditItemTemplate><ItemStyle Width="250px"></ItemStyle></asp:TemplateField><asp:TemplateField HeaderText="Page number" ItemStyle-Width="100"><ItemTemplate><asp:Label ID="IssueDate" runat="server" Text='<%# Eval("PagesNumber") %>'></asp:Label></ItemTemplate><EditItemTemplate><asp:TextBox ID="IssueDate" runat="server" Text='<%# Eval("PagesNumber") %>'></asp:TextBox></EditItemTemplate><ItemStyle Width="100px"></ItemStyle></asp:TemplateField><asp:TemplateField ShowHeader="False"><ItemTemplate><asp:Button ID="Button1" runat="server" Text="Button" CommandArgument="<%# ((GridViewRow) Container).RowIndex %>" /></ItemTemplate></asp:TemplateField></Columns></asp:GridView>

</ContentTemplate>


</asp:UpdatePanel>




<asp:Label ID="lbl111" runat="server"></asp:Label></div>

aspx.cs:

 protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
    {
        int index = Convert.ToInt32(e.CommandArgument);
        lbl111.Text = GridView1.Rows[index].Cells[1].Text;
    }

Any help please ? 

Ajax call does not receive GET-WebMethod ASMX Return value

$
0
0

First off, most threads and documentation on this are very very old, so I wonder whether there is some newer technology I don't know, that actually is an improvement on the situation.

However, I am trying to call a WebMethod via JQuery-Ajax and have it return a JSON object.
So I am using:

$.ajax({
   type: 'GET',
   url: 'ajaxtest.asmx/getData',
   success: function (data) { console.log(data) } [...]

and on the server side

<WebMethod()>
<ScriptMethod(UseHttpGet:=True, ResponseFormat:=System.Web.Script.Services.ResponseFormat.Json)>
Public Function getData() As String
Return getJSONFromDatatable(dt)

End Function

Now the server-code runs, and the JSON-serialization is no problem, but then I get some entirely different object which kind of looks like an document-object.

My web.config looks like this

<webServices>
<protocols>
<add name="HttpGet"/>
<add name="HttpPost"/>
</protocols>
</webServices>
<system.webServer>
<handlers>
<add name="ajax" verb="*" path="*.asmx"
type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35"/>
</handlers>
</system.webServer>

MS Chart flicker with every Timer Tick

$
0
0

Ref: https://www.raefkobeissi.com/aa/index2.aspx
Hello,

I've been working on a dynamic chart using DATA MS Charts in ASP.Net + AJAX Controls (Time and an update panel) I managed to make it work but I have a flickering problem. everytime the timer ticks and the chart updates a new chart image is loaded and this is causing flickering. Does anyone have any solution to this flickering problem:

<%@ Register assembly="System.Web.DataVisualization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35" namespace="System.Web.UI.DataVisualization.Charting" tagprefix="asp" %><%@ Page Language="VB" AutoEventWireup="true" %><script runat="server">

    Shared i
    Shared c = -1
    Shared a

    Shared mm(6, 99)
    Shared dt = 0.01
    Shared dx = 0.1
    Shared AC(6)
    Shared FC(6)
    Shared d = 0
    Shared J = 0
    Shared AA(6)
    Shared CO() = {1, 2, 3, 4, 5, 6, 7}
    Protected Sub Timer1_Tick(sender As Object, e As EventArgs)
        c = c + 1
        While J < 7
            AA(J) = mm(J, c)
            J = J + 1
        End While
        J = 0

        Chart1.Series(0).Points.DataBindXY(CO, AA)
        Label1.Text = c
        Chart1.Series(0).BorderWidth = 2
        Chart1.ResetAutoValues()

    End Sub
    Protected Sub Button1_Click(sender As Object, e As EventArgs)

        i = 0
        While i < 100
            mm(0, i) = Val(TextBox1.Text)
            i = i + 1
        End While
        mm(1, 0) = 1
        mm(2, 0) = 1
        mm(3, 0) = 2
        mm(4, 0) = 2
        mm(5, 0) = 1
        mm(6, 0) = 1
        i = 1
        a = 1
        While i < 100
            While a < 7
                mm(a, i) = mm(a, i - 1) - ((mm(a, i - 1) * dt / dx) * (mm(a, i - 1) - mm(a - 1, i - 1)))
                a = a + 1

            End While
            i = i + 1
            a = 1
        End While
        Timer1.Interval = 1500
        Timer1.Enabled = True
    End Sub</script><html><head><meta http-equiv="Content-Type" content="text/html; charset=windows-1252"><title>New Page 1</title></head><body><form id="form1" runat="server"><asp:ScriptManager ID="ScriptManager1" runat="server" EnableCdn="true" ></asp:ScriptManager><asp:Timer ID="Timer1" runat="server" OnTick="Timer1_Tick"></asp:Timer><asp:UpdatePanel ID="UpdatePanel1" runat="server"><Triggers><asp:AsyncPostBackTrigger ControlID="Timer1" EventName="Tick" /></Triggers><ContentTemplate><div style="position: absolute; width: 622px; height: 365px; z-index: 1; left: 751px; top: 127px" id="layer1"><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -153px; top: 271px" id="layer6">&nbsp;</div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -154px; top: 205px" id="layer5">&nbsp;</div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -154px; top: 135px" id="layer4">&nbsp;<asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -155px; top: 72px" id="layer3">&nbsp;<asp:TextBox ID="TextBox1" runat="server" Width="102px"></asp:TextBox></div><div style="position: absolute; width: 100px; height: 46px; z-index: 1; left: -156px; top: 11px" id="layer2">&nbsp;&nbsp;<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /></div><p><asp:Chart ID="Chart1" runat="server" Height="329px" Width="611px"
 ImageLocation="~/charts_0/" 
         ImageStorageMode="UseImageLocation" 
         ImageType="Png"> <series><asp:Series ChartType="Line" Name="Series1"></asp:Series></series><chartareas><asp:ChartArea Name="ChartArea1"></asp:ChartArea></chartareas></asp:Chart></ContentTemplate></asp:UpdatePanel></form></body></html>


Thank you 

Viewing all 5678 articles
Browse latest View live


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