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

Tab Control without headers

$
0
0

I would like to use the tab control but without headers, is this possible?

Effectively the user will select a button an a tab panel will become visible and the others hidden


Today's date is already disabled even though it is not yet 12:00am.

$
0
0

Hi!

How can I get the current time zone of my PC when using the Calendar Extender?
My problem is that after 04:00 PM in my country, it automatically disables the current date even though it's not yet 12:00 in the midnight.

Here's my code:

 protected void Page_Load(object sender, EventArgs e) {
            cal_DateFrom.StartDate = DateTime.Now;
 }

Update table Supplier with Jquery and Ajax

$
0
0

Hello, 

I am trying to update my table Supplier when user fill textboxes and when click on button.

Is it possible to update table Suppler with jquery and ajax?

My database consist of four tables: Supplier, Town, Street and Adress. 

Columns of table Town: TownID(primary key), NameTown

Columns of table Street: TownID,StreetID (composite primary key),NameStreet

Columns of table Adress: TownID,StreetID,NumberAdress(all of these columns are composite primary key)

Columns of table Supplier: SupplierID,NameSupplier,TownID,StreetID,NumberAdress,NumberOfPhone, Email

This is my View: for ChangeSupplier


@model FpisNada.Models.Dobavljac
@{
ViewBag.Title = "Index";

Layout = null;
}

@Html.TextBoxFor(model => model.SupplierID, new { @placeholder = "pib dobavljaca", style = " float:left" })

<div class="col-md-9">
@if (ViewBag.ListaMesta != null)
{
@Html.DropDownListFor(m => m.TownID, ViewBag.ListaMesta as SelectList, "--select mesto--", new { @class = "form-control", style = " float:left" })

}

@Html.DropDownListFor(m => m.StreetID, new SelectList(""), "--select ulicu--", new { @class = "form-control", style = " float:left" })


<div class="container">


@Html.TextBoxFor(model => model.NumberAdress, new { @class = "form-control"})
@Html.TextBoxFor(model => model.Email, new { @class = "form-control" })
@Html.TextBoxFor(model => model.NameSupplier, new { @class = "form-control" })
@Html.TextBoxFor(model => model.NumberOfPhone, new { @class = "form-control" })
</div>
</div>
<input type="button" value="Edit" id="update"/>

I appreciate any advice and help!

calender extender query - displaying result in textbox ??

$
0
0

hi,

I am using calender  extender in a form that is completed by USers

The problem is the selected date is displayed in the TextBox  like so

3/21/2017

This is ok for US users but I have English users and to them its the wrong format.

to solve the problem I want to display the date like this so everybody understands...

21 March 2017

here is my code

<asp:TextBox ID="txtDate" class="form-control" placeholder="click here to see calender" runat="server"></asp:TextBox><br /><asp:RequiredFieldValidator ID="RequiredFieldValidatorDate" CssClass="alert-text" runat="server" Text="Select Date"  ForeColor="Red"
                ControlToValidate="txtDate" ErrorMessage="Select Performance date" ToolTip="date  is required."
                                          SetFocusOnError="True" Display="Dynamic"></asp:RequiredFieldValidator><asp:CalendarExtender ID="DateTextBox1" TargetControlID="txtDate" runat="server" />

thank you

Filter date range from calendar to display in ajax chart reading from database

$
0
0

I recently able to work out how to filter date range from calendar to display in asp chart from database, but i tried converting to using ajax and i am struggling to convert.
Tried googling and stuff but it doesn't really show me much of it.
I hope you guys might be able to help me out.

This is the code behind for my chart

protected void BindChart1()
{
string cs = ConfigurationManager.ConnectionStrings["impgardenConnectionString"].ConnectionString;
using (MySqlConnection con = new MySqlConnection(cs))
{
DataSet ds = new DataSet();
DataTable dt = new DataTable();
con.Open();
using (MySqlCommand com = new MySqlCommand("SELECT Id,Temperature,ReadDateTime FROM smartterranium WHERE ReadDateTime BETWEEN @ViewDateFrom and @ViewDateTo ", con))
{
com.Parameters.AddWithValue("@ViewDateFrom", tbViewDateFrom.Text);
com.Parameters.AddWithValue("@ViewDateTo", tbViewDateTo.Text);

using (MySqlDataReader reader = com.ExecuteReader())
{
while (reader.Read())
{
LineChart1.Series.Add(new AjaxControlToolkit.LineChartSeries { LineColor = "#3dc0f4", Name = "Suppliers" });

}
}
}
}
}

This is the ajax datepicker.

<asp:Label ID="lblDateFrom" runat="server" Text="View Date From:"></asp:Label>&nbsp;&nbsp;&nbsp;<asp:TextBox ID="tbViewDateFrom" runat="server" AutoPostBack="True"></asp:TextBox><ajaxToolkit:CalendarExtender ID="CalExtViewDateFrom" runat="server"  BehaviorID="CalExtViewDateFrom" TargetControlID="tbViewDateFrom" Format="dd/MM/yy" /><asp:Label ID="lblDateTo" runat="server" Text="View Date To:"></asp:Label>&nbsp;&nbsp;&nbsp;<asp:TextBox ID="tbViewDateTo" runat="server" AutoPostBack="True"></asp:TextBox><ajaxToolkit:CalendarExtender ID="CalExtViewDateTo" runat="server"  BehaviorID="CalExtViewDateTo" TargetControlID="tbViewDateTo" Format="dd/MM/yy" /><asp:Button ID="btnSubmit" runat="server" Text="Filter" OnClick="btnSubmit_Click" />

This is the ajax calendar i want to use

ajaxToolkit:LineChart ID="LineChart1" runat="server"
          ChartTitleColor="#0E426C" CategoryAxisLineColor="#D08AD9"
          ValueAxisLineColor="#D08AD9" BaseLineColor="#A156AB"
          ChartTitle="Temperature"
          ChartHeight="300" ChartWidth="450" ChartType="Basic"></ajaxToolkit:LineChart>

Thanks alot!

Syntax error in HTML code and runtime error stating function is undefined

$
0
0

I'm trying to get a handle on ASP.NET web page coding in VisualStudio2008 (yep, I'm behind the times).  I used an MS Walk Through in MSDN titled "Walkthrough: Creating and Using AJAX-enabled ASP.NET Service".  When running the resulting web page, I kept getting an error "JavaScript runtime error:'OnClickGreetings' is undefined".  Finally, I gave up on that and found another, video based, tutorial titled "Creating and Using an AJAX-enabled Web Service in a Web Site".  I entered all of the code presented in that tutorial, but have at least 2 problems that I can't resolve.  Firstly, in VS, in the web page where I've embedded JavaScript, as instructed on the video, I have a small squiggly under the </script> closing tag.  When I hover over it, the tooltip says "Expecting more source characters".  I cannot for the life of me see what I' missing in the code between the <script> and </script> tags (I'm new to JavaScript, as well).

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"><style type="text/css">
            body { font: 11pt Trebuchet MS;
                   color: #000000;
                   padding-top: 72px;
                   text-align: center; }
            .text { font: 8pt Trebuchet MD }</style><title>Simple Web Service</title><script type="text/javascript">

    function OnGreetingsClick()
    {
        Samples.Aspnet.HelloWorld.Greetings(
            $get("NameTextBox").value,
            OnGreetingsComplete);
    {

    function OnGreetingsComplete(result)
    {
        var elem = $get("Results");
        elem.innerHTML = result;
    }</script></head><body><form id="form1" runat="server"><div><asp:ScriptManager runat="server"><Services><asp:ServiceReference Path="http://localhost/WT_HelloWorldWebService/HelloWorld.asmx" /></Services></asp:ScriptManager><h2>Simple Web Service Client</h2><p>Calling a simple service that shows a greeting
     and the server date and time</p><table><tr><td>Name:</td><td><input type="text"
                id="NameTextBox" /></td></tr><tr><td>&nbsp;</td><td><button id="GreetingsButton"
                onclick="OnGreetingsClick()">Greetings</button></td></tr></table></div><hr /><div><span id="Results"></span></div></form></body></html>


Secondly, if I ignore the  VS error, and try and run the page, it renders fine, but when I try to test the javascript function behind the Greetings button, I get an error similar to the one I got with the initial MS Walk Through, which is "Error: 'OnGreetingsClick' is undefined.  I'm hoping that this error may be a result of the syntax error, but I sure don't know what the syntax error is telling me.  Thanks for any light you can shed on this.

Text in flashes and disappears

$
0
0

I have a web site project I copied from the web, in an attempt to learn about java scripting (and ASP.NET programming in general).  When I test the page, it "sort of" works; that is, it updates the text in the <span> control to the value set by a function.  However, the text appears and disappears in a flash, so that, in an actual web page, it would be quite useless, unhelpful, annoying, etc.  Any help will be appreciated.  The page code is below:

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head id="Head1" runat="server"><style type="text/css">
            body { font: 11pt Trebuchet MS;
                   color: #000000;
                   padding-top: 72px;
                   text-align: center; }
            .text { font: 8pt Trebuchet MD }</style><title>Simple Web Service</title><script type="text/javascript">

    function OnGreetingsClick()
    {
        Samples.Aspnet.HelloWorld.Greetings(
        $get("NameTextBox").value,
        OnGreetingsComplete);
    }

    function OnGreetingsComplete(result)
    {
        var elem = $get("Results");
        elem.innerHTML = result;
    }</script></head><body><form id="form1" runat="server"><div><asp:ScriptManager runat="server"><Services><asp:ServiceReference Path="http://localhost/WT_HelloWorldWebService/HelloWorld.asmx" /></Services></asp:ScriptManager><h2>Simple Web Service Client</h2><p>Calling a simple service that shows a greeting
     and the server date and time</p><table><tr><td>Name:</td><td><input type="text"
                id="NameTextBox" /></td></tr><tr><td>&nbsp;</td><td><button id="GreetingsButton"
                onclick="OnGreetingsClick()">Greetings</button></td></tr></table></div><hr /><div><span id="Results"></span></div></form></body></html>

XMLHttpRequest Object

$
0
0

Hi,

The below code works on IE, Chrome etc but not with safari, 

function Add_PRD()
{

if (window.XMLHttpRequest) { u = new XMLHttpRequest;} else { u = new ActiveXObject("Microsoft.XMLHTTP"); }

u.onreadystatechange = function () {
if (u.readyState == 4 && u.status == 200) { Assign_Values1(u.responseText); }
}; u.open("GET", "Add_Product.aspx?Prd_ID=10", true);

u.send();return false;
}

Please advise why this doesn't work with Safari?


Modal Poup

$
0
0

I have a modal popup on a page, when I click to show, although it shows straight away, you cant actually click on anything for one to two seconds, when I close and open it up again it is fine.

Is there any way I can prevent this or at least indicate to the user that the dialog is still loading?  

Cascading DropDown and Select2 JQ

$
0
0

Hi All,

I use Cascading DropDown extender to populate my DropDown list via web method and its working perfectly fine, I get my fields populated with the text that I want and I can read their ids (SQL) using my vb.net

<asp:DropDownList ID="MarStatTxt" runat="server" onkeydown="return (event.keyCode!=13)"
                                    CssClass="form-control mb-md" ClientIDMode="Static"></asp:DropDownList><cc1:CascadingDropDown ID="cddlMarStatTxt" runat="server"
                                                    BehaviorID="cddlMarStatTxt" Category="MarStat"
                                                    LoadingText="Loading Marital Status..." PromptText="Select Marital Status"
                                                    ServiceMethod="GetMaritalStatus"
                                                    ServicePath="~/ARTSQLAPP/CONFIG/ARTSQLWbSrvDDL.asmx"
                                                    TargetControlID="MarStatTxt" />

once I add select2 plug in 

<asp:DropDownList ID="MarStatTxt" runat="server" onkeydown="return (event.keyCode!=13)"
                                    data-plugin-selectTwo CssClass="form-control mb-md" ClientIDMode="Static"></asp:DropDownList>

I can only read the text and I cant read the Id for that selected value.

I noticed that after I select the value, my cascade DropDown extender does not read the value 

i.e. 

without Select 2

<input type="hidden" name="ctl00$tst$cddlMarStatTxt_ClientState" id="tst_cddlMarStatTxt_ClientState" value="1:::Single:::">

with select2

<input type="hidden" name="ctl00$tst$cddlMarStatTxt_ClientState" id="tst_cddlMarStatTxt_ClientState" value="::::::">

any idea please on how i can get this feature to work?

thanks

p AjaxControlToolkit HTMLEditor - Won't accept full stop keypress

$
0
0

I referred to the following link but don't seem to fix it in my case. 

http://stackoverflow.com/questions/20407211/ajaxcontroltoolkit-htmleditor-wont-accept-full-stop-keypress

Error - 0x800a138f - JavaScript runtime error: Unable to get property 'PRM_TimeoutError' of undefined or null reference

$
0
0

Hello. I have asp.net project and I keep getting this error "0x800a138f - JavaScript runtime error: Unable to get property 'PRM_TimeoutError' of undefined or null reference" when I'm trying to open the report, that pulls data from SQL - report is build using stored procedure in the dataset (sending parameters to it). All parameters are not null, and if I preview results in the dataset manually - getting data. Do I need to declare 'PRM_TimeoutError' somewhere?

The error comes up on the first line (within 'Name'DataSetDesigner.cs):

public spSumExceptionsDataTable() {               this.TableName = "spSumExceptions";               this.BeginInit();               this.InitClass();               this.EndInit();           }

Stops at this line of MsAjaxJs -_createPageRequestManagerTimeoutError:function() var t="Sys.WebForms.PageRequestManagerTimeoutException: "+Sys.WebForms.Res.PRM_TimeoutError

Using in the project -  CDNPath=http://ajax.aspnetcdn.com/ajax/4.5.1/1/MicrosoftAjaxWebForms.js

Combobox is not firing the textchanged event useing ajax control

$
0
0

Hi

i am using  combox 

as below in aspx page

<ajaxToolkit:ComboBox ID="ComboBox_JCcode" runat="server" DropDownStyle="DropDownList" AutoCompleteMode="Suggest" CssClass="AquaStyle" OnTextChanged="ComboBox_JCcode_TextChanged"></ajaxToolkit:ComboBox>

but it is  not firing the textchange event  please help me

Multiple Fieldsets in a Row

$
0
0

The following code gives me one panel in each row; how do I get it to return 2 <fieldset> items in a row so I will have "File" and "File2" in the same row?

<script>$(document).ready(function(){$("p").append('<fieldset><legend>File:</legend><a href="create.html">Create File</a><br><a href="edit.html">Edit File</a><br><a href="Delete.html">Delete File</a></fieldset>');$("p").append('<fieldset><legend>File:</legend><a href="create.html">Create File</a><br><a href="edit.html">Edit File</a><br><a href="Delete.html">Delete File</a></fieldset>');$("p").append('<fieldset><legend>MISC:</legend><a href="Help.html">Help</a><br><a href="about.html">About us</a></fieldset>');

});
</script>

Cannot access background images for the TabContainer style

$
0
0

Hi!

   I have place a tabcontainer with tabpanels on an aspx page.  I'm using Visual Studio 2017 and installed the latest version of the Ajax Toolkit.

   At the top of the page, I've placed a CSS style to customize the tabs.

   I made sure that the AjaxControlToolkit is a registered assembly on that page.

   I have placed the name of the CSS style in the tabcontainer properties, and the control is recognizing the style to a certain extent.  I'm able to change some aspects of the style such as the font color and a few other things.  However, it isn't using the images I'm referencing as the background.

   I have tried placing these images everywhere I possibly can, but it's just not finding them.  I've put them directly in the same folder as the aspx file I'm calling.  I've created an images folder below that.  I even placed a copy of the images folder above that   The only images being used are the default images for the XP theme.  I have no clue where those images are stored aside from the SampleSite that came with the AjaxToolkit.

   I've tried  .../images        .../.../images    I've tried it with quotation marks  (both double and single) and without, and no matter how I try to reference these images, it just isn't working.  I've even tried referencing the images directly with no relative path at all after placing them in the same folder as the aspx file, and that isn't working either.

   It's as though the control is refusing to use anything but its default images.  I hope someone here can help.

    <style type="text/css">
        .Tab .ajax__tab_header {
            color: #4682b4;
            font-family: Arial;
            font-size: Small;
            font-weight:200;
            background-color: #ffffff;
            margin-left: 0px;
            margin-top:10px;
            margin-bottom: 10px;
            height:35px;
        }
        /*Body*/
        .Tab .ajax__tab_body {
            border: 1px solid #b4cbdf;
            padding-top: 0px;
        }
        /*Tab Active*/
        .Tab .ajax__tab_active .ajax__tab_tab {
            color: #000000;
            font-size: small;
            background: url('images/tab_active.gif') repeat-x;
            height: 25px;
            margin-top:10px;
            margin-bottom: 10px;
        }

        .Tab .ajax__tab_active .ajax__tab_inner {
            color: #666666;
            background: url('images/tab_left_active.gif') no-repeat left;
            padding-left: 10px;
        }

        .Tab .ajax__tab_active .ajax__tab_outer {
            color: #ffffff;
            background: url('images/tab_right_active.gif') no-repeat right;
            padding-right: 6px;
        }
        /*Tab Hover*/
        .Tab .ajax__tab_hover .ajax__tab_tab {
            color: #000000;
            background: url('images/tab_hover.gif') repeat-x;
            height: 25px;
            margin-top:10px;
            margin-bottom: 10px;
        }

        .Tab .ajax__tab_hover .ajax__tab_inner {
            color: #000000;
            background: url('images/tab_left_hover.gif') no-repeat left;
            padding-left: 10px;
        }

        .Tab .ajax__tab_hover .ajax__tab_outer {
            color: #000000;
            background: url('images/tab_right_hover.gif') no-repeat right;
            padding-right: 6px;
        }
        /*Tab Inactive*/
        .Tab .ajax__tab_tab {
            color: #666666;
            font-size: small;
            background: url('images/tab_Inactive.gif') repeat-x;
            height: 25px;
            margin-top:10px;
            margin-bottom: 10px;
        }

        .Tab .ajax__tab_inner {
            color: #666666;
            background: url('images/tab_left_inactive.gif') no-repeat left;
            padding-left: 10px;
        }

        .Tab .ajax__tab_outer {
            color: #666666;
            background: url(images/tab_right_inactive.gif) no-repeat right;
            padding-right: 6px;
            margin-right: 2px;
        }
    </style>

Thank you!


Hyperlinks inside Accordion/Repeater Pane

$
0
0

How do I add multiple hyperlinks inside the pane from the database? Currently, it displays "Title" in the header and "Content" inside it.

<table border="0" ><tr><td class="label_topped"><div id="dvAccordian" style = "width:400px"><asp:Repeater ID="rptAccordian" runat="server"><ItemTemplate><h3><%# Eval("Title") %></h3><div><p><%# Eval("Content") %></p></div></ItemTemplate></asp:Repeater></div></td><td class="auto-style2"></td></tr></table>
private void BindRepeater()
    {
        string constr = ConfigurationManager.ConnectionStrings["constr"].ConnectionString;
        using (SqlConnection con = new SqlConnection(constr))
        {
            using (SqlCommand cmd = new SqlCommand())
            {
                cmd.CommandText = "select Title, Content from AccordianContent";
                cmd.Connection = con;
                con.Open();
                rptAccordian.DataSource = cmd.ExecuteReader();
                rptAccordian.DataBind();
                con.Close();
            }
        }
    }



AutoCompleteExtender quit working

$
0
0

Hi,

I adopted an old application.  The AutoCompleteExtender has recently quit working.  Why would this happen?  The code has not changed in over 2 years?  

Here is part of the source (the part I thought would help find a solution anyway) - 

<asp:TextBox runat="server" ID="autoCompleteTextBox" Width="300" /><ajaxToolkit:AutoCompleteExtender runat="server" BehaviorID="AutoCompleteEx" ID="autoComplete1"
TargetControlID="autoCompleteTextBox" ServicePath="http://ciifapps/logins/MyWebService.asmx"
ServiceMethod="GetCompletionList2" UseKeyValuePairs="True" FirstRowSelected="True"
OnClientHidden="clientHidden"
OnClientItemSelected ="clientSelected" MinimumPrefixLength="2" OnClientShowing="clientShowing"
CompletionInterval="500" EnableCaching="true" CompletionSetCount="20"
CompletionListCssClass="autocomplete_completionListElement"
CompletionListItemCssClass="autocomplete_listItem" DelimiterCharacters=",;"
CompletionListHighlightedItemCssClass="autocomplete_highlightedListItem" OnClientPopulating="clientPopulating" />

Here is the code behind - 

Imports Utilities
Imports System.Data
Imports System.Data.SqlClient
Imports System.Data.Odbc

Partial Class Ajax
    Inherits BasePage

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

        Me.Master.TabGroup = Utilities.TabGroup.UserAccounts

        Dim css As New HtmlLink
        css.Href = "CSS/StaffLookup.css"
        css.Attributes("rel") = "stylesheet"
        css.Attributes("type") = "text/css"
        css.Attributes("media") = "all"
        Page.Header.Controls.Add(css)

        Dim sbd As New StringBuilder("")
        With sbd
            .Append("function requeryForm() {")
            .Append(ClientScript.GetPostBackEventReference(Me.refreshButton, ""))
            .Append(";return true;}")
        End With
        ScriptManager.RegisterClientScriptBlock(Me.Page, Me.GetType, "K001", sbd.ToString, True)

        Dim EmpID As Int32 = 0

        If Not Request.QueryString("EmpID") Is Nothing Then
            EmpID = Convert.ToInt32(Request.QueryString("EmpID"))
            Me.SqlDataSource1.SelectParameters(0).DefaultValue = EmpID
        End If

    End Sub

    Protected Sub refreshButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
        Me.FormView1.DataBind()
    End Sub

    Protected Sub deleteLink_Click(ByVal sender As Object, ByVal e As System.EventArgs)


        Dim cnn As New SqlConnection(Utilities.GetConnectionString("main"))
        cnn.Open()
        Dim s As String = ""
        Dim recs As Int32 = 0
        Dim Username As String = CType(sender, LinkButton).CommandArgument
        Dim cmd As New System.Data.SqlClient.SqlCommand("DELETE FROM tblUser WHERE UsrLogin=@UsrLogin", cnn)
        cmd.Parameters.AddWithValue("@UsrLogin", Username)
        recs = cmd.ExecuteNonQuery()
        cmd.Dispose()


        ' ------------------------------------------------------------------------------------------------------
        Dim cnn2 As System.Data.Odbc.OdbcConnection
        Dim cmd2 As System.Data.Odbc.OdbcCommand
        Dim i As Int32 = 0

        cnn2 = New System.Data.Odbc.OdbcConnection(GetConnectionString("access95mdw"))
        cnn2.Open()

        i = 0
        cmd2 = New System.Data.Odbc.OdbcCommand()
        cmd2.Connection = cnn2
        cmd2.CommandText = "DROP USER [" & Username & "]"
        Try
            i = cmd2.ExecuteNonQuery()
        Catch ex As Exception
            ' Handle Errors
        End Try
        cmd2.Dispose()
        cnn2.Close()
        cnn2.Dispose()


        cnn2 = New System.Data.Odbc.OdbcConnection(GetConnectionString("access2kmdw"))
        cnn2.Open()
        cmd2 = New System.Data.Odbc.OdbcCommand()
        i = 0
        cmd2.Connection = cnn2
        cmd2.CommandText = "DROP USER [" & Username & "]"
        Try
            i = cmd2.ExecuteNonQuery()
        Catch ex As Exception
            ' Handle Errors
        End Try

        cmd2.Dispose()
        cnn2.Close()
        cnn2.Dispose()
        ' ------------------------------------------------------------------------------------------------------

        cnn.Close()
        cnn.Dispose()

        If s.Length > 0 Then
            Me.statusLabel.Text = s
        Else
            Response.Redirect("Ajax.aspx")
        End If


    End Sub

    Protected Sub changePasswordLink_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        Response.Redirect("ChangePassword.aspx?EmpID=" & CType(sender, LinkButton).CommandArgument)

    End Sub


    Protected Sub addLoginLinkButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)

        Dim c As Object
        Dim url As String = "LoginAdd.aspx"

        c = Me.FormView1.FindControl("EmpIDLabel")
        url &= "?EmpID=" & Server.UrlEncode(CType(c, Label).Text)

        Response.Redirect(url)

    End Sub


End Class

Any ideas why this code would just stop working? 

Thank you in advance for any help.

Best regards,

Mark

a website with ajaxControlKit works on old machine but not the new machine

$
0
0

Hello All,

i have this asp.net website which has a few AjaxControlToolkit controls.

version of Ajaxcontrolkit dll is 15.1

this website works fine on my old machine windows 7 enterprise , VS PRO 2013 , .Net Framework4.5.5...

but it always errors out with a  "0x800a138f - JavaScript runtime error: Unable to get property 'UI' of undefined or null reference" on my new machine on the dynamic  aspx page 

new machine also has windows 7 enterprise, VS PRO 2013 , .Net Framework 4.6.01...

is there a reason why the ajax control kit controls should error out on my new machine.

i have looked at several articles related to the error  "0x800a138f - JavaScript runtime error: Unable to get property 'UI' of undefined or null reference".

i have re-installed the ajax control kit but no matter what it still errors out.

what files am i missing

any help on this issue

Error handling in webmethod

$
0
0

how can I apply error handling in a webmethod, how can I return ex.Message ?

I have this code for example

<WebMethod()> _
    Public Function SrcTblReg(ByVal SrchTxt As String, ByVal FnameSrctxt As String, _
                                  ByVal SnameSrctxt As String, ByVal TnameSrctxt As String, _
                                  ByVal LnameSrctxt As String, ByVal TelSrcTxt As String, _
                                  ByVal SSNSrcTxt As String, ByVal EmailSrctxt As String, _
                                  ByVal DOBSrcTxt As String)


        Dim constr As String = ConfigurationManager.ConnectionStrings("ARTSQLConStrng").ConnectionString
        Using con As New SqlConnection(constr)
            Using cmd As New SqlCommand("TblRegSearch", con)
                cmd.CommandType = CommandType.StoredProcedure

                If (String.IsNullOrEmpty(SrchTxt)) Then
                    cmd.Parameters.Add("@Searchtxt", SqlDbType.NVarChar).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Searchtxt", SqlDbType.NVarChar).Value = SrchTxt
                End If
                If (String.IsNullOrEmpty(FnameSrctxt)) Then
                    cmd.Parameters.Add("@Fname", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Fname", SqlDbType.NVarChar).Value = FnameSrctxt
                End If
                If (String.IsNullOrEmpty(SnameSrctxt)) Then
                    cmd.Parameters.Add("@Sname", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Sname", SqlDbType.NVarChar).Value = SnameSrctxt
                End If
                If (String.IsNullOrEmpty(TnameSrctxt)) Then
                    cmd.Parameters.Add("@Tname", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Tname", SqlDbType.NVarChar).Value = TnameSrctxt
                End If
                If (String.IsNullOrEmpty(LnameSrctxt)) Then
                    cmd.Parameters.Add("@Lname", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Lname", SqlDbType.NVarChar).Value = LnameSrctxt
                End If
                If (String.IsNullOrEmpty(TelSrcTxt)) Then
                    cmd.Parameters.Add("@TelMob", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@TelMob", SqlDbType.NVarChar).Value = TelSrcTxt
                End If
                If (String.IsNullOrEmpty(SSNSrcTxt)) Then
                    cmd.Parameters.Add("@SSnum", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@SSnum", SqlDbType.NVarChar).Value = SSNSrcTxt
                End If
                If (String.IsNullOrEmpty(EmailSrctxt)) Then
                    cmd.Parameters.Add("@Email", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = EmailSrctxt
                End If
                If (String.IsNullOrEmpty(DOBSrcTxt)) Then
                    cmd.Parameters.Add("@DOB", SqlDbType.Date).Value = DBNull.Value
                Else
                    Dim DOBDte As DateTime = String.Format("{0:dd-MMMM-yyyy}", DOBSrcTxt)
                    cmd.Parameters.Add("@DOB", SqlDbType.Date).Value = DOBDte
                End If
                cmd.Connection = con
                con.Open()
                    Dim ds As New DataSet()
                    Using sda As New SqlDataAdapter(cmd)
                        sda.Fill(ds, "TblRegSrc")
                    End Using
                    con.Close()
                    Return ds.GetXml()
                End Using
        End Using
    End Function

JSON Retrieval Speed

$
0
0

 Hi all

I m using the following codes to populate HTML table,

<WebMethod()> _
    Public Function SrcTblReg(ByVal SrchTxt As String, ByVal FnameSrctxt As String, _
                                  ByVal SnameSrctxt As String, ByVal TnameSrctxt As String, _
                                  ByVal LnameSrctxt As String, ByVal TelSrcTxt As String, _
                                  ByVal SSNSrcTxt As String, ByVal EmailSrctxt As String, _
                                  ByVal DOBSrcTxt As String)
        Dim constr As String = ConfigurationManager.ConnectionStrings("ARTSQLConStrng").ConnectionString
        Using con As New SqlConnection(constr)
            Using cmd As New SqlCommand("TblRegSearch", con)
                cmd.CommandType = CommandType.StoredProcedure
                If (String.IsNullOrEmpty(SrchTxt)) Then
                    cmd.Parameters.Add("@Searchtxt", SqlDbType.NVarChar).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Searchtxt", SqlDbType.NVarChar).Value = SrchTxt.Trim()
                End If
                If (String.IsNullOrEmpty(FnameSrctxt)) Then
                    cmd.Parameters.Add("@Fname", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Fname", SqlDbType.NVarChar).Value = FnameSrctxt
                End If
                If (String.IsNullOrEmpty(SnameSrctxt)) Then
                    cmd.Parameters.Add("@Sname", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Sname", SqlDbType.NVarChar).Value = SnameSrctxt
                End If
                If (String.IsNullOrEmpty(TnameSrctxt)) Then
                    cmd.Parameters.Add("@Tname", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Tname", SqlDbType.NVarChar).Value = TnameSrctxt
                End If
                If (String.IsNullOrEmpty(LnameSrctxt)) Then
                    cmd.Parameters.Add("@Lname", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Lname", SqlDbType.NVarChar).Value = LnameSrctxt
                End If
                If (String.IsNullOrEmpty(TelSrcTxt)) Then
                    cmd.Parameters.Add("@TelMob", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@TelMob", SqlDbType.NVarChar).Value = TelSrcTxt
                End If
                If (String.IsNullOrEmpty(SSNSrcTxt)) Then
                    cmd.Parameters.Add("@SSnum", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@SSnum", SqlDbType.NVarChar).Value = SSNSrcTxt
                End If
                If (String.IsNullOrEmpty(EmailSrctxt)) Then
                    cmd.Parameters.Add("@Email", SqlDbType.Int).Value = DBNull.Value
                Else
                    cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value = EmailSrctxt
                End If
                If (String.IsNullOrEmpty(DOBSrcTxt)) Then
                    cmd.Parameters.Add("@DOB", SqlDbType.Date).Value = DBNull.Value
                Else
                    Dim DOBDte As DateTime = String.Format("{0:dd-MMMM-yyyy}", DOBSrcTxt)
                    cmd.Parameters.Add("@DOB", SqlDbType.Date).Value = DOBDte
                End If
                cmd.Connection = con
                    Dim ds As New DataSet()
                    Using sda As New SqlDataAdapter(cmd)
                        sda.Fill(ds, "TblRegSrc")
                    End Using
                    Return ds.GetXml()
                End Using
            End Using
    End Function
function srctbl() {$(function () {
                var obj = {};

                obj.SrchTxt = $('#srctxt').val()
                obj.FnameSrctxt =$('#fnamesrc').val()
                obj.SnameSrctxt = $('#snamesrc').val()
                obj.TnameSrctxt = $('#tnamesrc').val()
                obj.LnameSrctxt = $('#lnamesrc').val()
                obj.TelSrcTxt = $('#telsrc').val()
                obj.SSNSrcTxt = $('#ssnsrc').val()
                obj.EmailSrctxt = $('#emailsrc').val()
                obj.DOBSrcTxt = $('#dobsrc').val()$.ajax({
                    type: "POST",
                    url: "../CONFIG/WebSerTblsSearch.asmx/SrcTblReg",
                    data: JSON.stringify(obj),
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: OnSuccess2,
                    failure: function (response) {
                        alert('f' + response.d);
                    },
                    error: function (response) {
                        alert('E' + response.d);
                    }
                });
            });

            function OnSuccess2(response) {
                var xmlDoc = $.parseXML(response.d);
                var xml = $(xmlDoc);
                var customers = xml.find("TblRegSrc");
                var row = $("[id*=RegSrc] > tbody tr:last-child").clone(true);$("[id*=RegSrc] tr").not(':has(th)').remove();$.each(customers, function () {$("#ptfn", row).html($(this).find("Column1").text());$("#ptname", row).html($(this).find("FullName").text());$("#ptdob", row).html($(this).find("DOB").text());$("[id*=RegSrc]").append(row);
                    row = $("[id*=RegSrc] > tbody tr:last-child").clone(true);
                })
            }
        }


The code performs search in a table, whenever I get more than 500 rows, the speed in data retrieval drops drastically, the table takes a long time to populate.

any idea how to speed the process up?

thanks

Viewing all 5678 articles
Browse latest View live


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