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

shopping cart Count using ajax

$
0
0

Hi,

I'm implementing Online shopping Cart.

in my website's header want to show  total shopping cart Count with out reload/refresh the whole page.

Please post any sample script  or logic.

Appropriate for your quick and better response.


Form to Email is not working in my hosted page

$
0
0

I have created a Form to Email in my contact  page in order to allow users to communicate and interact with the site. However, When I hosted my website, I set the SMTP on live mail using 587 port. Then I decided to get a hosting mail from my service provider. So I configured my code behind according to the new server that is the hosting one. My problem is  the form doesn't like the new configuration and kept sending to my live mail. The e-mail is working perfectly in my development PC and doesn't give me any exception, but it doesn't work once uploaded into my domain file manager. 

I used Ajax toolkit to prevent postback in my page, add watermark and also using the update progress for loading purposes! I have a real doubt of using Ajax control toolkit by thinking it might be the main reason for the form not working as it supposes to be! Any help to solve this matter would be much appreciated

This is the form script:

<asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></asp:ToolkitScriptManager>

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

<table >
<tr>
<td class="auto-style29" style="vertical-align:top; text-align: left;">
<asp:Label ID="Label1" runat="server" Font-Italic="False" Font-Names="Lucida Sans" Text="Name"></asp:Label>
</td>
<td style="text-align: left" class="auto-style30" >
<asp:TextBox ID="txtName" runat="server" CssClass="styling" width="350px"></asp:TextBox>
<asp:TextBoxWatermarkExtender ID="txtName_TextBoxWatermarkExtender" runat="server" Enabled="True" TargetControlID="txtName" WatermarkCssClass="styling" WatermarkText="Enter your name">
</asp:TextBoxWatermarkExtender>
</td>
<td class="auto-style31">
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ControlToValidate="txtName" ErrorMessage="Your name is required!" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style32" style="vertical-align:top; text-align: left;">
<asp:Label ID="Label4" runat="server" Font-Bold="False" Font-Italic="False" Font-Names="Lucida Sans" Text="Email" style="text-align: left"></asp:Label>
</td>
<td class="auto-style33">
<asp:TextBox ID="txtEmail" runat="server" CssClass="styling" width="350px"></asp:TextBox>
<asp:TextBoxWatermarkExtender ID="txtEmail_TextBoxWatermarkExtender" runat="server" Enabled="True" TargetControlID="txtEmail" WatermarkCssClass="styling" WatermarkText="Enter your email">
</asp:TextBoxWatermarkExtender>
</td>
<td class="auto-style33">
<asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ControlToValidate="txtEmail" ErrorMessage="Your Email is required!" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
<asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" ControlToValidate="txtEmail" Display="Dynamic" ErrorMessage="Please enter a valid emaill " ForeColor="Red" ValidationExpression="\w+([-+.']\w+)*@\w+([-.]\w+)*\.\w+([-.]\w+)*">*</asp:RegularExpressionValidator>
</td>
</tr>
<tr>
<td class="auto-style32" style="vertical-align:top; text-align: left;">
<asp:Label ID="Label2" runat="server" Font-Bold="False" Font-Italic="False" Font-Names="Lucida Sans" Text="Subject" style="text-align: left"></asp:Label>
</td>
<td class="auto-style33">
<asp:TextBox ID="txtSubject" runat="server" CssClass="styling" width="350px"></asp:TextBox>
<asp:TextBoxWatermarkExtender ID="txtSubject_TextBoxWatermarkExtender" runat="server" Enabled="True" TargetControlID="txtSubject" WatermarkCssClass="styling" WatermarkText="Enter a subject">
</asp:TextBoxWatermarkExtender>
</td>
<td class="auto-style33">
<asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ControlToValidate="txtSubject" ErrorMessage="Subject is required!" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style34" style="vertical-align:top; text-align: left;">
<asp:Label ID="Label3" runat="server" Font-Italic="False" Font-Names="Lucida Sans" Text="Message" style="text-align: left"></asp:Label>
</td>
<td class="auto-style26" style="vertical-align:top;">
<asp:TextBox ID="txtMessage" runat="server" CssClass="styling" Height="80px" Rows="5" TextMode="MultiLine" width="389px"></asp:TextBox>
<asp:TextBoxWatermarkExtender ID="txtMessage_TextBoxWatermarkExtender" runat="server" Enabled="True" TargetControlID="txtMessage" WatermarkCssClass="styling" WatermarkText="Enter your message">
</asp:TextBoxWatermarkExtender>
</td>
<td class="auto-style34" style="vertical-align:top;">
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtMessage" ErrorMessage="Message is required!" ForeColor="Red" Text="*"></asp:RequiredFieldValidator>
</td>
</tr>
<tr>
<td class="auto-style45" colspan="3">
<asp:Label ID="lblmsg" runat="server" Font-Bold="True" Font-Names="Lucida Sans"></asp:Label>
</td>
</tr>
<tr>
<td class="auto-style27" colspan="3">
<asp:UpdateProgress ID="UpdateProgress1" runat="server">
<ProgressTemplate>
<asp:Image ID="Image3" runat="server" Height="27px" ImageUrl="~/Images/loading.gif" style="text-align: right" Width="42px" />
</ProgressTemplate>
</asp:UpdateProgress>
</td>
</tr>
<tr>
<td class="auto-style8" colspan="3">

<asp:Button ID="btnSub" runat="server" BackColor="#916E80" BorderColor="#916E80" Font-Bold="True" Font-Names="Lucida Sans" ForeColor="White" Text="Submit" Height="35px" Width="84px" OnClick="btnSub_Click1" />

</td>
</tr>

<tr>
<td class="auto-style10" colspan="3">
<asp:ValidationSummary ID="ValidationSummary1" runat="server" Font-Names="Lucida Sans" ForeColor="Red" HeaderText="Please correct the following errors!" Width="299px" />
</td>
</tr>
<tr>
<td class="auto-style19" colspan="3">
&nbsp;</td>
</tr>
</table>

</ContentTemplate>
</asp:UpdatePanel>

This is the code behind for event:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Net;
using System.Net.Mail;
using System.Web.UI.WebControls;

namespace Christech
{
public partial class ContactUs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
ScriptManager.ScriptResourceMapping.AddDefinition("jquery", new ScriptResourceDefinition
{
Path = "~/scripts/jquery-1.9.1.js"
});

}

protected void btnSub_Click1(object sender, EventArgs e)
{
System.Threading.Thread.Sleep(2000);
try
{

MailMessage mail = new MailMessage();
mail.From = new MailAddress(txtEmail.Text);
mail.To.Add("Myhostingmail@mail.com");
mail.Subject = txtSubject.Text;
mail.Body = "<b> Sender Name: </b>" + txtName.Text + "<br/>"
+ "<b> Sender Email: </b>" + txtEmail.Text + "<br/>"
+ "<b> Sender Comment: </b>" + txtMessage.Text;
mail.IsBodyHtml = true;

SmtpClient smtpClient = new SmtpClient("server@mail.com", 587);
smtpClient.EnableSsl = false;
smtpClient.UseDefaultCredentials = false;
smtpClient.Credentials = new
System.Net.NetworkCredential("Myhostingmail@mail.com", "Password");
smtpClient.Send(mail);

lblmsg.Text = "Thank you for contacting us";

txtName.Text = "";
txtEmail.Text = "";
txtSubject.Text = "";
txtMessage.Text = "";


}

catch (Exception ex)
{
lblmsg.Text = "An unexpected error has occured! " + ex.Message;


}
}
}
}

Return as "Json Object" instead of a "string".

$
0
0

I want to know how to return json1 as a "Json Object" instead of a "string".

 [WebMethod]
        public static string getJson()
        {
             ...
            var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            var json1 = serializer.Serialize(gvlist).ToString();
            return json1;
        }

Ajax to read my json string

$
0
0

I have a subroutinr:

 [WebMethod]
        public static string gvAjax()
        {
            List<Table1> gvlist = new List<Table1>();
            ...
            var serializer = new System.Web.Script.Serialization.JavaScriptSerializer();
            var json1 = serializer.Serialize(gvlist).ToString();
            return json1;
        }

I get a string from the WebMethod of the form "[{"Id":1,"col1":"11","col2":"22","col3":"33"},"{"Id":2,"col1":"44","col2":"55","col3":"66"},"{"Id":3,"col1":"77","col2":"88","col3":"99"}]"

The alert gives a message of "undefined". 

How do I get Ajax to read my json string?

<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script><script type="text/javascript">$(function () {$("#<%= Button2.ClientID %>").click(function (e) {
                e.preventDefault();$.ajax({
                    type: "POST",
                    url: "/Default.aspx/gvAjax",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    data: JSON.stringify({}),
                    async: true,
                    cache: false,
                    success: function (data) {
                        alert(data.d);
                    },
                    error: function (x, e) {
                        alert("Error: " + x.responseText);
                    }
                });
            });
        });</script>

Best resource to learn How to Create AJAX enabled User Controls

$
0
0

In our project, we use lot of User Controls.  None of them supports AJAX.  We use UpdatePanel for partial page rendering.  There is no proper client side functions for the controls.

I used to create normal JS functions in the ascx page itself.  I guess it is not the standard way to add client functionality to a User Control. However i can achieve all the things which i required , with out using any such standards. But when considering the maintainability, it is tough & it is hard to make changes & not scalable. 

So i want to learn the proper way to create AJAX enabled User Controls.  Just like how Telerik & other 3rd party controls create User Controls. What is the recommended way to create such controls by Microsoft. 

Update Panel empty

$
0
0

Hello,

I have an update panel in a table cell. Inside the update panel I have buttons and a multiview. Since I packed the label, buttons and the multiview in the update panel, the tablecell is an empty div. The DOM structure is

<div>

  <asp:table>

    <asp:tablerow>

       <asp:tablecell>

        <asp:scriptmanager id="scmMain" runat="server" />

        <asp:updatepanel id="uppMyPanel" runat="server">

           <asp:contenttemplate>

             <asp:label>

             <asp:button1>.... <asp:button n>

             <asp:multiview>  <asp:view> ...image <asp:view> ..... <asp:view> ...image <asp:view>

             </asp:multiview>

           </asp:contenttemplate>

          </asp:updatepanel>

         </asp:tablecell>

        <asp:tablecell>  an image logo displaying correctly </asp:tablecell>

      </asp:tablerow>

    </asp:table>

  </div>

This is what I have when I inspect the element:

<div id="head_menu"><table id="tblMenu" cellpadding="10" border="0" style="width:100%;"><tr id="tblRow2"><td id="tblCell5" align="center" valign="top" style="background-color:#FFBF00;width:70%;">       <script type="text/javascript">
//<![CDATA[
Sys.WebForms.PageRequestManager._initialize('scmMain', 'form1', ['tuppMyPanel',''], [], [], 90, '');
		//]]></script><div id="uppMyPanel"></div></td><td id="tblCell6" align="center" valign="top" style="width:30%;"><img id="imgLogo" src="Images/MyLogo.gif" style="border-width:0px;" /></td></tr></table>

I added the System.Web.Extensions assembly in the web.config file.

I inspected the element in Mozilla and in Chrome, there is absolutely no error. My cell is empty and yellow.

There is no css setting hidden property for the controls.

I found no forum with something similar...

This is in IIS7, .NET 4.0

<add assembly="System.Web.Extensions, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>

Thank and regards,

Alex

Visual Studio 2008 to Visual Studio 2012

$
0
0

I am new to 2012. I see in the toolbox there is a tab for AJAX EXtensions. I remember in 2008 I had to import AJAX tool box. Is AJAX now included in 2012?

I brought an existing web form and code from a 2008 version as I want to try and start converting 2008 to 2012.  In the first page i brought over in 2008 I am using a ToolkitscriptManager, but it does not exist in 2012.   in 2012 they have a scriptmanager, ScriptmanagerProxy, a Timer, Update Panel and Update Progress.

So I am a little confused as to what I should be doing here.  Do I still need to import an AJAX toolbox in, or do I no longer use a toolkitscriptmanager ?

Thanks

Time data type format problem in FormView

$
0
0

I have a gridview and a formview - where I have a couple of date fields and a couple of time fields, respectively defined as "Date" and "Time" in aspx and of type "date" and "time(7)" in MSSQL 2008 r2. In the gridview I only display data but use a FormView to edit as well as Insert new rows. I have formatted these fields both in gridview as well as FromView using

Text='<%#Bind("StartDate","{0:d}") %>'

Text='<%# Bind("StartTIme", "{0:t}") %>'

respectively. I would like to exclude seconds part from the display but that is not a major problem at the moment. The problem is when I click "Edit" link, where first I hide gridview panel and open formview panel and put the form in edit mode. The main problem is: When FormView opens, it does not keep time format of "99:00". It displays only hour and AJAX mask edit extender does not show up its format until the cell is clicked. e.g. if the hour is 8, it displays as 8 and not "08:00" and when the cell is clicked it shows, "80:00"!!! The problem is if someone just changes any other fields on the form, and in the formview does not click into these time fields (because they are not going to change times), it throws error, since the time values read are not in proper format. I will provide code snippets for gridview and formview edit.

gridview item template:  

<asp:TemplateFieldHeaderText="Start Time"SortExpression="StartTime">

<ItemTemplate>

<asp:LabelID="lblStartTime"runat="server"Text='<%# Bind("StartTime", "{0:t}") %>'></asp:Label>

</ItemTemplate>

</asp:TemplateField>

FormView edit and item templates are essentially identical:

<asp:labelID="lblStartTime"runat="server"Text="Start Time:.................."/>

<asp:TextBoxID="txtStartTime"runat="server"height="20px"Text='<%# Bind("StartTIme", "{0:t}") %>'

ToolTip="Please enter a StartTime in HH:MM format."/>

<asp:MaskedEditExtenderID="MaskedEditExtender1"runat="server"AutoComplete="true"UserTimeFormat="TwentyFourHour"

AcceptAMPM="false"Mask="99:00"MaskType="None"TargetControlID="txtStartTime">

</asp:MaskedEditExtender>

<asp:RequiredFieldValidatorID="RequiredFieldValidator1"runat="server"

ControlToValidate="txtStartTime"Display="Dynamic"

ErrorMessage="StartTime cannot be blank! Please enter a StartTime between hours 6 to 22."/>

<asp:RangeValidatorID="RangeValidator1"runat="server"ControlToValidate="txtStartTime"MinimumValue="05:00"MaximumValue="22:00"

ErrorMessage="StartTime has to be between 06:00 and 22:00!" Display="Dynamic"/>

code behind:

ProtectedSub GridView1_RowCommand(ByVal sender AsObject,ByVal e AsGridViewCommandEventArgs)

lblShow.Text =""

If e.CommandName = "Insert"Then

gvPanel.Visible =False

GridView1.Visible =False

fvPanel.Visible =True

FormView1.Visible =True

FormView1.ChangeMode(FormViewMode.Insert)

GridView1.DataBind()

EndIf

If e.CommandName = "Edit"Then

Dim iTheIndexNow AsInteger
IfInteger.TryParse(e.CommandArgument.ToString(), iTheIndexNow) Then
' Set and highlight the selected

GridView1.SelectedIndex = iTheIndexNow

End
If

' Console.WriteLine(iTheIndexNow)

IfNot GridView1.SelectedValue IsNothingThen

FormView1.PageIndex = GridView1.SelectedIndex

FormView1.DataBind()

FormView1.ChangeMode(FormViewMode.Edit)

GridView1.DataBind()

gvPanel.Visible =False

GridView1.Visible =False

fvPanel.Visible =True

FormView1.Visible =True

EndIf

EndIf

EndSub


Please I need help, I tried everything, find every solution of google but none of them works. ModalPopUp not working

$
0
0

Here's the :

Master Page:

<%@ Master Language="C#" AutoEventWireup="true" CodeBehind="Site.master.cs" Inherits="Fleet.SiteMaster" %>

<!DOCTYPE html>
<html lang="en">
<head runat="server">
    <meta charset="utf-8" />
    <title><%: Page.Title %> - My ASP.NET Application</title>
    <asp:PlaceHolder runat="server">     
          <%: Scripts.Render("~/bundles/modernizr") %>
    </asp:PlaceHolder>  
    <webopt:BundleReference runat="server" Path="~/Content/css" />
    <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
    <meta name="viewport" content="width=device-width" />
    <asp:ContentPlaceHolder runat="server" ID="HeadContent" />
</head>
<body>
    <form runat="server">
        <asp:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" EnableScriptGlobalization="True">
        <Scripts>
            <%--To learn more about bundling scripts in ScriptManager see http://go.microsoft.com/fwlink/?LinkID=272931&clcid=0x409 --%>
            <%--Framework Scripts--%>
            
            <asp:ScriptReference Name="MsAjaxBundle" />
            <asp:ScriptReference Name="jquery" />
            <asp:ScriptReference Name="jquery.ui.combined" />
            <asp:ScriptReference Name="WebForms.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebForms.js" />
            <asp:ScriptReference Name="WebUIValidation.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebUIValidation.js" />
            <asp:ScriptReference Name="MenuStandards.js" Assembly="System.Web" Path="~/Scripts/WebForms/MenuStandards.js" />
            <asp:ScriptReference Name="GridView.js" Assembly="System.Web" Path="~/Scripts/WebForms/GridView.js" />
            <asp:ScriptReference Name="DetailsView.js" Assembly="System.Web" Path="~/Scripts/WebForms/DetailsView.js" />
            <asp:ScriptReference Name="TreeView.js" Assembly="System.Web" Path="~/Scripts/WebForms/TreeView.js" />
            <asp:ScriptReference Name="WebParts.js" Assembly="System.Web" Path="~/Scripts/WebForms/WebParts.js" />
            <asp:ScriptReference Name="Focus.js" Assembly="System.Web" Path="~/Scripts/WebForms/Focus.js" />
            <asp:ScriptReference Name="WebFormsBundle" />
            <%--Site Scripts--%>

        </Scripts>
    </asp:ToolkitScriptManager>
    <header>
        <div class="content-wrapper">
            <div class="float-left">
                <p class="site-title">
                    <a runat="server" href="~/">your logo here</a>
                </p>
            </div>
            <div class="float-right">
                <section id="login">
                    <asp:LoginView runat="server" ViewStateMode="Disabled">
                        <AnonymousTemplate>
                            <ul>
                                <li><a id="registerLink" runat="server" href="~/Account/Register">Register</a></li>
                                <li><a id="loginLink" runat="server" href="~/Account/Login">Log in</a></li>
                            </ul>
                        </AnonymousTemplate>
                        <LoggedInTemplate>
                            <p>
                                Hello, <a runat="server" class="username" href="~/Account/Manage" title="Manage your account">
                                    <asp:LoginName runat="server" CssClass="username" /></a>!
                                <asp:LoginStatus runat="server" LogoutAction="Redirect" LogoutText="Log off" LogoutPageUrl="~/" />
                            </p>
                        </LoggedInTemplate>
                    </asp:LoginView>
                </section>
                <nav>
                    <ul id="menu">
                        <li><a runat="server" href="~/">Home</a></li>
                        <li><a runat="server" href="~/About">About</a></li>
                        <li><a runat="server" href="~/Contact">Contact</a></li>
                    </ul>
                </nav>
            </div>
        </div>
    </header>
    <div id="body">
        <asp:ContentPlaceHolder runat="server" ID="FeaturedContent" />
        <section class="content-wrapper main-content clear-fix">
            <asp:ContentPlaceHolder runat="server" ID="MainContent" />
        </section>
    </div>
    <footer>
        <div class="content-wrapper">
            <div class="float-left">
                <p>&copy; <%: DateTime.Now.Year %> - My ASP.NET Application</p>
            </div>
        </div>
    </footer>
    </form>
</body>
</html>

Default Page:

<%@ Page Title="Daftar Voucher Adhya Tirta Batam" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Voucher.aspx.cs" Inherits="Fleet.Contact" %>

<asp:Content runat="server" ID="BodyContent" ContentPlaceHolderID="MainContent">
    <hgroup class="title">
        <h1><%: Title %></h1>
    </hgroup>

        <table align="center" style="width: 99%; margin-left: 0px; margin-right: 0px;">
            <tr>
                <td class="auto-style1">Kode Voucher</td>
                <td class="auto-style3">
                    <asp:TextBox ID="TextBox1" runat="server" Width="300px"></asp:TextBox>
                </td>
                <td class="auto-style2">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="RequiredFieldValidator" Font-Bold="True" ForeColor="Red" ControlToValidate="TextBox1"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="auto-style1">Kode SPBU</td>
                <td class="auto-style3">
                    <asp:TextBox ID="TextBox2" runat="server" Width="300px"></asp:TextBox>
                </td>
                <td class="auto-style2">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server" ErrorMessage="RequiredFieldValidator" Font-Bold="True" ForeColor="Red" ControlToValidate="TextBox2"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <tr>
                <td class="auto-style1">NIK</td>
                <td class="auto-style3">
                    <asp:TextBox ID="TextBox3" runat="server" Width="300px"></asp:TextBox>
                </td>
                <td class="auto-style2">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server" ErrorMessage="RequiredFieldValidator" Font-Bold="True" ForeColor="Red" ControlToValidate="TextBox3"></asp:RequiredFieldValidator>
                </td>
            </tr>
             <tr>
                <td class="auto-style1">Nama</td>
                <td class="auto-style3">
                    <asp:TextBox ID="TextBox4" runat="server" Width="300px"></asp:TextBox>
                 </td>
                <td class="auto-style2">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ErrorMessage="RequiredFieldValidator" Font-Bold="True" ForeColor="Red" ControlToValidate="TextBox4"></asp:RequiredFieldValidator>
                 </td>
            </tr>
            <tr>
                <td class="auto-style1">Tanggal &amp; Waktu</td>
                <td class="auto-style3">
                    <asp:TextBox ID="TextBox5" runat="server" Width="160px"></asp:TextBox>
                    <asp:TextBox ID="TextBox6" runat="server" Width="130px"></asp:TextBox>
                </td>
                <td class="auto-style2">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator6" runat="server" ErrorMessage="RequiredFieldValidator" Font-Bold="True" ForeColor="Red" ControlToValidate="TextBox5"></asp:RequiredFieldValidator>
                </td>
            </tr>
            <td class="auto-style1">KM Bacaan</td>
                <td class="auto-style3">
                    <asp:TextBox ID="TextBox7" runat="server" Width="300px"></asp:TextBox>
                 </td>
                <td class="auto-style2">
                    <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ErrorMessage="RequiredFieldValidator" Font-Bold="True" ForeColor="Red" ControlToValidate="TextBox7"></asp:RequiredFieldValidator>
                 </td>
             <tr>
                <td class="auto-style1">&nbsp;</td>
                <td class="auto-style3">
                    <asp:Button ID="Insert" runat="server" Text="Insert" />
                    <asp:Button ID="View" runat="server" Text="View" />
    <asp:ModalPopupExtender ID="ModalPopupExtender1" runat="server" OkControlID="Close" PopupControlID="Panel1" TargetControlID="View" BackgroundCssClass="modalBackground"></asp:ModalPopupExtender>

                 </td>
                <td class="auto-style2">&nbsp;</td>
            </tr>
        </table>
    <asp:Panel ID="Panel1" runat="server">
        <asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" DataKeyNames="KdVoucher" DataSourceID="SqlDataSource1" EmptyDataText="There are no data records to display." Width="670px">
            <Columns>
                <asp:BoundField DataField="KdVoucher" HeaderText="KdVoucher" ReadOnly="True" SortExpression="KdVoucher" />
                <asp:BoundField DataField="KdSPBU" HeaderText="KdSPBU" SortExpression="KdSPBU" />
                <asp:BoundField DataField="NIK" HeaderText="NIK" SortExpression="NIK" />
                <asp:BoundField DataField="Nama" HeaderText="Nama" SortExpression="Nama" />
                <asp:BoundField DataField="TglVoucher" HeaderText="TglVoucher" SortExpression="TglVoucher" />
                <asp:BoundField DataField="WktVoucher" HeaderText="WktVoucher" SortExpression="WktVoucher" />
                <asp:BoundField DataField="KMBacaan" HeaderText="KMBacaan" SortExpression="KMBacaan" />
            </Columns>
        </asp:GridView>
        <asp:Button ID="Close" runat="server" Text="Close" />
        <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:fleetConnectionString1 %>" DeleteCommand="DELETE FROM [Voucher] WHERE [KdVoucher] = @KdVoucher" InsertCommand="INSERT INTO [Voucher] ([KdVoucher], [KdSPBU], [NIK], [Nama], [TglVoucher], [WktVoucher], [KMBacaan]) VALUES (@KdVoucher, @KdSPBU, @NIK, @Nama, @TglVoucher, @WktVoucher, @KMBacaan)" ProviderName="<%$ ConnectionStrings:fleetConnectionString1.ProviderName %>" SelectCommand="SELECT [KdVoucher], [KdSPBU], [NIK], [Nama], [TglVoucher], [WktVoucher], [KMBacaan] FROM [Voucher]" UpdateCommand="UPDATE [Voucher] SET [KdSPBU] = @KdSPBU, [NIK] = @NIK, [Nama] = @Nama, [TglVoucher] = @TglVoucher, [WktVoucher] = @WktVoucher, [KMBacaan] = @KMBacaan WHERE [KdVoucher] = @KdVoucher">
            <DeleteParameters>
                <asp:Parameter Name="KdVoucher" Type="Int32" />
            </DeleteParameters>
            <InsertParameters>
                <asp:Parameter Name="KdVoucher" Type="Int32" />
                <asp:Parameter Name="KdSPBU" Type="String" />
                <asp:Parameter Name="NIK" Type="Int32" />
                <asp:Parameter Name="Nama" Type="String" />
                <asp:Parameter Name="TglVoucher" Type="String" />
                <asp:Parameter DbType="Time" Name="WktVoucher" />
                <asp:Parameter Name="KMBacaan" Type="Int32" />
            </InsertParameters>
            <UpdateParameters>
                <asp:Parameter Name="KdSPBU" Type="String" />
                <asp:Parameter Name="NIK" Type="Int32" />
                <asp:Parameter Name="Nama" Type="String" />
                <asp:Parameter Name="TglVoucher" Type="String" />
                <asp:Parameter DbType="Time" Name="WktVoucher" />
                <asp:Parameter Name="KMBacaan" Type="Int32" />
                <asp:Parameter Name="KdVoucher" Type="Int32" />
            </UpdateParameters>
        </asp:SqlDataSource>
    </asp:Panel>
    </asp:Content>
<asp:Content ID="Content1" runat="server" contentplaceholderid="HeadContent">
    <style type="text/css">
        .auto-style1 {
            text-align: left;
            width: 107px;
        }
        .auto-style2 {
            width: 168px;
        }
        .auto-style3 {
            width: 316px;
        }
    </style>
</asp:Content>

Need Fast Reply cause My deadline on March 3 2015

AJAX Toolkit broken

$
0
0

I installed ajax toolkit many times and try to add and delete the ajax toolbox cause, all of tools are nonfunctional, can you guys tell me whats the problem..??

i use visual studio 2013 and download the ajax toolkit from NuGet

sorry for my bad English

Ajax support in User Control

$
0
0

I have this User Control that (as a part of its rendering phase) needs to execute some javascript at client-side. I use ScriptManager.RegisterStartupScript to register the script I want to execute when response reaches the client. Now, in my scenario my control is contained inside an Update panel (to be more precise, it is ajaxified using a Telerik RadAjaxManager). On the same page, I have a second Update panel (again to be more precise, a second panel ajaxified with a second RadAjaxManager setting). When this second panel raises a partial postback, I expect the changes (including any emitted script) from my control to be ignored. This is not the case and frustratingly, I cannot determine what to do? Any ideas ?

Exit Sub in an Update Panel

$
0
0

This is with ASP.NET VB.  I use a message box and Exit Sub to stop a calculation with missing data.

Public Sub MsgBox(ByVal Message As String)
System.Web.HttpContext.Current.Response.Write("<SCRIPT LANGUAGE=""JavaScript"">" & vbCrLf)
System.Web.HttpContext.Current.Response.Write("alert(""" & Message & """)" & vbCrLf)
System.Web.HttpContext.Current.Response.Write("</SCRIPT>")
End Sub

If Val(txtSalesPrice.Text) = 0 Or Val(txtIntRate.Text) = 0 Then
MsgBox("Please enter a sales price and an interest rate.")
Exit Sub
End If

This works until I add an Update Panel.  Then neither the message box or the Exit Sub work inside the Update Panel.  

Any ideas about this?

Thanks,

Carthalion

Ajax ModalPopupExtender

$
0
0

Hi,

ModalPopupExtender...RepositionMode="None" is working fine in all browsers..but causes problem in iPad. if I setRepositionMode="None" then popup does not show  at all in iPad. I needRepositionMode="None" because I want popup to scroll along the page.

Thanks.

Drag with Nested ModalPopupExtender

$
0
0

I am using the ModalPopupExtender in a user control and nesting that user control to create nested modal popups.  Everything works fine with the nesting and the dragging is good on the primary layer of popups but any nested popups shift when I click on their drag handle so that the popup is now some distance down and to the right of the mouse cursor.  Dragging then works as normal but the popup is away from the cursor. Has anyone else experienced this?  Does anyone know of a solution?

SliderExtender problem with property xmlns:ajaxtoolkit

$
0
0

I am using a slider extender control.  Every time I build, this property is automatically added to the slider extender properties by Visual Studio 2013:

xmlns:ajaxtoolkit="ajaxcontroltoolkit"

Then it gives me an error "Type 'AjaxControlToolkit.SliderExtender' does not have a public property named 'xmlns:ajaxtoolkit'."

I manually delete all of them (I have about 20 sliders!)...Then as soon as re-build, they're BACK!!!

I registered AjaxControlToolkit tag prefix in my web config file:

<addtagPrefix="ajaxToolkit"assembly="AjaxControlToolkit"namespace="AjaxControlToolkit" />

What is going on?

(BTW, somebody ought to improve this text area.  It's a pain to  type or paste anything in here.)

Appreciate any assistance


Sliders with -100 to 100 range problems

$
0
0

Hi,

I have multiple sliders inside a jQuery accordion control.  I'm using custom CSS for the slider rails and handles.  Problem is, when I try to move the handle, I get an error:

"Error: Sys.ArgumentException: Please set valid values for the height and width attributes in the slider's CSS classes
Parameter name: element size"

Then the sliders are replaced by the Slider textboxes and I get a NullReferenceException.

I don't need to change slider values using textboxes, so I don't want the textboxes to show at all.  It seems like it is not allowing negative values for the sliders.  But I need the range from minus 100 to positive 100.

Here's a sample of my CSS:

<style type="text/css">
.croplandhandle{   
    position: relative;
    height:24px; 
    width:17px;  
}
.croplandrail{
    position: relative;
    height: 20px;
    width: 200px;
    background: url('images/sliders/cropland_rail.png');
    border-radius: 8px;
}
</style>

Here's a sample of my slider inside an accordion:

<div id="divLulcSliders">
                    <div style="text-align:left">Cropland</div>
                    <div style="text-align:center"> 
                    <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <Triggers>
                        <asp:AsyncPostBackTrigger controlid="CroplandSlider" eventname="TextChanged" />
                    </Triggers>
                    <ContentTemplate>
                        <asp:Label ID="CroplandSlider_BoundControl" runat="server"  AssociatedControlID="CroplandSlider" />
                        <asp:TextBox ID="CroplandSlider" runat="server" AutoPostBack="True"
                             BorderStyle="None" Text="0" TabIndex="500" OnTextChanged="CroplandSlider_TextChanged" >
                        </asp:TextBox>                   
                        <ajaxToolkit:SliderExtender ID="CroplandSliderExtender" runat="server"
                            BehaviorID="CroplandSlider"
                            TargetControlID="CroplandSlider"
                            BoundControlID="CroplandSlider_BoundControl"
                            Minimum="-100"
                            Maximum="100"
                            Steps="1"
                            RailCssClass="croplandrail"
                            HandleCssClass="croplandhandle"
                            EnableHandleAnimation="true" 
                            RaiseChangeOnlyOnMouseUp  ="true"
                            HandleImageUrl="~/images/sliders/corn_handle.png">
                    </ajaxToolkit:SliderExtender>
                    </ContentTemplate>
                </asp:UpdatePanel>
      </div>

Appreciate any assistance.

AjaxControlToolkit Slider's TextChanged event not firing

$
0
0

Hi,

I need for the slider to execute a code behind when users slide it and stop.  Somehow, the code behind method is not firing.  Does anyone have a solution?  Below is my C# code:

protected void CroplandSlider_TextChanged(object sender, EventArgs e)
{
  //get value from dropdownlist
  string huccode = ddlHuccodes.Text;
  
  //call the method
  DisplayScenarioPieChart(huccode);
}

ASPX:

<ajaxToolkit:SliderExtender ID="CroplandSliderExtender" runat="server">
  BehaviorID = "CroplandSlider"
  Minimum=-100
  Maximum=100
  BoundControlID="CroplandSlider_BoundControl"
  RailCssClass="croplandrail"
  HandleCssClass="croplandhandle"
  HandleImageUrl="~/images/sliders/corn_handle.png"
  RaiseChangeOnlyOnMouseUp="true"
  EnableHandleAnimation="true">
</ajaxToolkit:SliderExtender>

<div>
  <asp:Label ID="CroplandSlider_BoundControl" runat="server" AssociatedControlID="CroplandSlider"/>
  <asp:TextBox ID="CroplandSlider" runat="server" AutoPostBack="True" Text="0" BorderStyle="None" ReadOnly="true" OnTextChanged="CroplandSlider_TextChanged"/>
</div>

I can't figure out why the method is not firing when user stop sliding.  Appreciate any help.


  
 

AsyncFileUpload disappears

$
0
0

AsyncFileUpload disappears when near by asp dropdownlist postbacks, both the controls
are inside update panel

Get client browser version in C# (When IE Compatibility mode enabled)

$
0
0

We need to know client's browser version from C# code (Server side). We use Request.Browser or HTTP_USER_AGENT to get the details. However, In IE when compatibility mode is enabled it always returns IE 7 version irrespective of version of IE. ie, even in IE 11 when compatibility mode enabled it returns IE 7 but I want actual version which is IE 11. Is there any way I can get actual IE version?

ajax issue

$
0
0
Hi friend,
I using ajax modalpopups , on my pc and testing pc, it is working well.
After deployment on real server, all ajax controls are not working anymore, all popup can not prompt anymore.
Please tell what is root cause and how can i solve?
I just publish my project and deploy on server,
For ajax, i just add reference ajaxcontroltoolkit to my project
But now not working for ajax modalpopup.
Pls tell me how can i solve?
Viewing all 5678 articles
Browse latest View live


Latest Images