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

CascadingDropDown - Resets after postback

$
0
0

I have a set of filters that make use of CascadingDropDown. When a user has selected values in the CascadingDropDown and then clicks a button which posts the page back, all the dropdowns reset themselves back and forget the values the user selected before the postback. Is this normal?


ValidatorCalloutExtender don't work in Firefox

$
0
0

I have a ValidatorCalloutExtender in a normal aspx (along with its corresponding ToolkitScriptManager), but in Firefox does not work, do not jump validations! In IE10 and chrome works properly.

Do I have to do something special to make it work in Firefox?

Thanks.

jQuery UI - Download Excel

$
0
0

I have certain Report Links. When clicking on this I have a .NET/C# library that generates Excel &  associated Charts using Excel COM Interop. After it generates it drops the file in a Web Share. 

My effort is when I click on the Report Link. I want to open the Excel file with a traditional Open/Save As Options. My GUI is built using jQuery UI.

I already have a stand alone ASP.NET web Page if executed opens the file with the Pop Up to save since the Response MIME Type is Excel. But when I use Ajax Call through jQuery it doesnt download the file 

What is the best way to integrate this solution ?

editor bottom toolbar

$
0
0

I have been searching for a way to hide the bottom toolbar for the editor. I keep seeing to add this to the css file...

.ajax__htmleditor_editor_bottomtoolbar {
    display:none;
}

I have added it, but can not figure out how to use it from the codebehind page to toggle the bottom toolbar on/off. I am using VB as language. Could someone help with an example please?

Issue with line graph display on internet explorer

$
0
0

I'm currently running multiple line graphs, and while they work perfectly on other web browsers, running them in internet explorer is causing an issue. As its draws the linegraph, every other most recent point (so 3 out of 6)  doesnt immediately plot on the graph, but on the bottom under the x-axis. If my graph only has 5 points, the number will stay there and not ever populate correctly in the graph. Keeping 6 data points prevents that issue, but i have the graphs refreshing often and that animation is not acceptable.

Here's an example of the asp code. I've already checked the CssClass and its not related to that. 

<ajax:LineChart ID="Tickets runat="server" CssClass="breadcrumb"
ChartTitle="Tickets " BorderStyle="None" ChartWidth="420" ChartHeight="300"></ajax:LineChart>

And the series creation in code behind.

Tickets.Series.Add(new AjaxControlToolkit.LineChartSeries { LineColor = "Blue", Data = ticketScore, Name = "Scores" });

Any ideas on how to stop this? If there is a way to just disable the animation of the graphs and have them static i would be willing to do that as an alternative.

Javascript Slider Position Asp.net website

$
0
0

I want to add slider on asp.net web project here is the javascrtipt that I found

#sliderFrame, #sliderFrame div {
    box-sizing: content-box;
}
#sliderFrame 
{
    position:relative;
    width:700px;
    margin:0 auto; /*center-aligned*/


}

#slider, #slider div.sliderInner {
    width:700px;height:306px;/* Must be the same size as the slider images */
}

#slider {
	background:#fff url(loading.gif) no-repeat 50% 50%;
	position:relative;
	margin:0 auto; /*center-aligned*/

    transform: translate3d(0,0,0);
    box-shadow: 0px 1px 5px #999999;

}

/* image wrapper */
#slider a.imgLink, #slider div.video {
	z-index:2;

	position:absolute;
	top:0px;left:0px;border:0;padding:0;margin:0;
	width:100%;height:100%;
}
#slider .video {
	background:transparent url(video.png) no-repeat 50% 50%;
}

/* Caption styles */
#slider div.mc-caption-bg, #slider div.mc-caption-bg2 {
	position:absolute;
	width:100%;
	height:auto;
	padding:10px 0;/* 10px will increase the height.*/
	left:0px; /*if the caption needs to be aligned from right, specify by right instead of left. i.e. right:20px;*/
	bottom:0px;/*if the caption needs to be aligned from top, specify by top instead of bottom. i.e. top:150px;*/
	z-index:3;
	overflow:hidden;
	font-size: 0;

}
#slider div.mc-caption-bg 
{
    /* NOTE: Its opacity is to be set through the sliderOptions.captionOpacity setting in the js-image-slider.js file.*/
	background:Black;/* or any other colors such as White, or: background:none; */
}
#slider div.mc-caption-bg2 {
    background:none;
}
#slider div.mc-caption {
	font: bold 14px/20px Arial;
	color:#EEE;
	z-index:4;
	text-align:center;
    background:none;
}
#slider div.mc-caption a {
	color:#FB0;
}
#slider div.mc-caption a:hover {
	color:#DA0;
}


/* ------ built-in navigation bullets wrapper ------*/
/* Note: check themes\2\js-image-slider.css to see how to hide nav bullets */
#slider div.navBulletsWrapper  {
    top:250px;/* Its position is relative to the #slider */
	text-align:center;
	background:none;
	position:relative;
	z-index:5;
}

/* each bullet */
#slider div.navBulletsWrapper div 
{
    width:11px; height:11px;
    font-size:0;color:White;/*hide the index number in the bullet element*/
    background:transparent url(bullet.png) no-repeat 0 0;
    display:inline-block; *display:inline; zoom:1;
    overflow:hidden;cursor:pointer;
    margin:0 6px;/* set distance between each bullet*/
}

#slider div.navBulletsWrapper div.active {background-position:0 -11px;}


/* --------- Others ------- */

#slider div.loading 
{
    width:100%; height:100%;
    background:transparent url(loading.gif) no-repeat 50% 50%;
    filter: alpha(opacity=60);
    opacity:0.6;
    position:absolute;
    left:0;
    top:0; 
    z-index:9;
}

#slider img, #slider>b, #slider a>b {
	position:absolute; border:none; display:none;
}

#slider div.sliderInner {
	overflow:hidden; 
	-webkit-transform: rotate(0.000001deg);/* fixed the Chrome not crop border-radius bug*/
	position:absolute; top:0; left:0;
}

#slider>a, #slider video, #slider audio {display:none;}
#slider div {-webkit-transform: translate3d(0,0,0);transform: translate3d(0,0,0);}

and this I wrote on my default.aspx file

<div id="sliderFrame"><div id="slider"><img src="images/1.png" alt="TextHolder" /><img src="images/2.png" alt="TextHolder" /><img src="images/3.png" alt="TextHolder" /><img src="images/4.png" alt="TextHolder" /></div></div>

then in css I tried to put slider down with margin-top

.sliderFrame{

margin-top: 125px;}

but didnt work.slider always moves together with navigator.I also tried to use margin-top in javascript but they both move together.I just want to move slider below navigator

ss

No Source Available using the ModalPopupControl

$
0
0

Hi,

Earlier I put a post in the forum for gridview and other data controls regarding the SlectedIndexChanged not firing.

However I am using an Ajax ModalPopupControl to display data. This control might be my problem and not so much the other controls.

When I try to debug the code behind I get the "No Source Available" error message.

This is confusing because if I run the app no error messages and I do see data populating in my DataList control, but I can't select a new record to view.

Any solutions on why I am getting this "No Source Available" message?

Previous post - http://forums.asp.net/t/2041293.aspx?SelectedIndexChanged+will+not+fire+using+a+ModalPopupExtender 

 

 

Onclick event in Ajax Modal PopUp Extender.

$
0
0

Hello

In GridView which in UpdatePanel, I've a ImageButton that firing via OnRowcommand Event then displaying AjaxModalPopUp Extender.

In my Modal PopUp I've Button with Onclick event. Modal PopUp displaying BUT

OnClick Event doesnt firing.

//gridview Image Button<asp:TemplateField HeaderText="Tel"><ItemTemplate><asp:ImageButton runat="server" ID="ContactDetails" ImageUrl="~/Images/Phone-icon.png" CausesValidation="false"
Width="20" Height="20" CommandName="WantToSeeContact" CommandArgument='<%# Bind("DiaID")%>' /><asp:HiddenField runat="server" ID="HiddenFieldUserID" Value='<%# Bind("UserID")%>' /></ItemTemplate></asp:TemplateField>
//modal<ajaxToolkit:ModalPopupExtender ID="ModalPopupExtender1" runat="server" TargetControlID="Panel2"
                                    PopupControlID="Panel2" ></ajaxToolkit:ModalPopupExtender><asp:Panel ID="Panel2" runat="server" Width="500" Height="500"
                                    Style="background-color: #6f95f4; color: #000000; display: none"><div class="style1"><br /><br /><br /><br /><br /><table style="width: 90%; height: 71px;"><tr><td>Item Name</td><td><asp:Label ID="lblItemName" runat="server" Text="Label"></asp:Label></td></tr><tr><td>Price</td><td><asp:Label ID="lblPrice" runat="server" Text="Label"></asp:Label></td></tr><tr><td colspan="2">&nbsp;</td></tr></table><br /><br /><asp:Button ID="btnAddToCart" runat="server" Text="Evet"
                                        onclick="btnAddToCart_Click"     /><br /><br /><asp:Button ID="btnClose" runat="server" Text="Close"
                                            Width="199px" /></div></asp:Panel>


use ajax, json object to call webservice in asp.net using VB and getting error method error 500 .Any help will be appreciated

$
0
0

HERE IS MY WEBSERCIE.ASMX.VB 

Imports System.Web
Imports System.Web.Services
Imports System.Web.Services.Protocols
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Imports AjaxControlToolkit
Imports System.Collections.Specialized
Imports System.ComponentModel

' To allow this Web Service to be called from script, using ASP.NET AJAX, uncomment the following line.
<System.Web.Script.Services.ScriptService()> _
<System.Web.Services.WebService(Namespace:="http://tempuri.org/")> _
<System.Web.Services.WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
<Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
Public Class WebService1
Inherits System.Web.Services.WebService

Dim con As New ADODB.Connection
Dim conStr As String = System.Configuration.ConfigurationManager.ConnectionStrings("ConnectionString").ToString

Public Function fetchid(knownCategoryValues As String, category As String) As CascadingDropDownNameValue()
If con.State = ConnectionState.Closed Then
con.Open(conStr)
End If
Dim cmd As New ADODB.Command
cmd.ActiveConnection = con
cmd.CommandText = "SELECT DISTINCT PD_MERCH_VMDB.VW_ADHOC_MER_SKU.SPPLR_ID AS supID, PD_MERCH_VMDB.VW_ADHOC_MER_SKU.PROD_CD as prodCD FROM PD_MERCH_VMDB.VW_ADHOC_MER_SKU"
cmd.CommandType = ADODB.CommandTypeEnum.adCmdText
'Dim adp As New Odbc.OdbcDataAdapter()
Dim ds As New DataSet()
' adp.Fill(ds)
con.Close()
Dim ids As New List(Of CascadingDropDownNameValue)()
For Each dtRow As DataRow In ds.Tables(0).Rows
Dim Suppid As String = dtRow("Supp_ID").ToString()
Dim prodcd As String = dtRow("PROD_CD").ToString()
ids.Add(New CascadingDropDownNameValue(Suppid, prodcd))
Next
Return ids.ToArray()
End Function


Public Function fetchils(knownCategoryValues As String, category As String) As CascadingDropDownNameValue()
Dim prodcd As Integer
Dim strIds As StringDictionary = AjaxControlToolkit.CascadingDropDown.ParseKnownCategoryValuesString(knownCategoryValues)
prodcd = Convert.ToInt32(strIds("suppid"))
con.Open(conStr)
Dim cmd1 As New ADODB.Command
cmd1.ActiveConnection = con
cmd1.CommandText = "SELECT DISTINCT PD_MERCH_VMDB.vw_uda_adhoc.mer_uda_30_ds AS ILS,PD_MERCH_VMDB.VW_ADHOC_MER_SKU.SPPLR_ID AS supID, PD_MERCH_VMDB.VW_ADHOC_MER_SKU.SPPLR_NM AS supName FROM PD_MERCH_VMDB.VW_ADHOC_MER_SKU FULL OUTER JOIN PD_MERCH_VMDB.vw_uda_adhoc ON (PD_MERCH_VMDB.VW_ADHOC_MER_SKU.PROD_CD=PD_MERCH_VMDB.vw_uda_adhoc.prod_cd) where PD_MERCH_VMDB.VW_ADHOC_MER_SKU.SPPLR_ID =@Suppid"
cmd1.CommandType = ADODB.CommandTypeEnum.adCmdText

'here is tghe line to look
' cmd1.Parameters.AddWithValue("@Suppid", Suppid)
' cmd1.ExecuteNonQuery()


' Dim dails As New SqlDataAdapter()
Dim ds As New DataSet()
' dails.Fill(ds)
con.Close()
Dim ils As New List(Of CascadingDropDownNameValue)()
For Each dtRow As DataRow In ds.Tables(0).Rows
Dim ilscode As String = dtRow("ils").ToString()
Dim suppName As String = dtRow("Supp_Nm").ToString()
ils.Add(New CascadingDropDownNameValue(suppName, ilscode))
Next
Return ils.ToArray()
End Function


End Class

HERE IS MY ASPX PAGE NAMED AS HOME.ASPX

<%@ Page Language="vb" EnableEventValidation="false" AutoEventWireup="true" CodeBehind="home.aspx.vb" %>

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

<!DOCTYPE html>
<script runat="server">

Protected Sub Page_Load(sender As Object, e As EventArgs)

End Sub
</script>

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

<body>
<form id="form1" runat="server" >
<asp:ScriptManager ID="Scriptmanager1" runat="server">
<Services>
<asp:ServiceReference Path="~/WebService1.asmx" />
</Services>
</asp:ScriptManager>

<table>
<tr>
<td>Select ID:</td>
<td>
<asp:DropDownList ID="suppid" runat="server" Width="187px" />
<cc1:CascadingDropDown ID="csid" runat="server"
Category="suppid"
TargetControlID="suppid"
PromptText="-- Select --"
LoadingText="[Loading ...]"
ServiceMethod="fetchids"
ServicePath="~/WebService1.asmx" />

</td>
</tr>
<tr>
<td>Select ILS:</td>
<td>
<asp:DropDownList ID="ilslist" runat="server" Width="187px" AutoPostBack="false">
</asp:DropDownList>
<cc1:CascadingDropDown ID="csdils" runat="server"
ParentControlID="suppid"
Category="ils"
TargetControlID="ilslist"
PromptText="-- Select --"
LoadingText="Loading.."
ServiceMethod="fetchils"
ServicePath="~/WebService1.asmx"></cc1:CascadingDropDown>
</td>
</tr>
</table>

</form>

</body>
</html>

ASP.Net 4.5 AJAX Control Toolkit Accordion Not Working

$
0
0

Dear DotNet Dudes

I cannot get the accordion control to work.

The control appears on my screen with the first pane open, but clicking on headers does not open other panes.

I've spent some time on this and I can't find anything on Google.

I'm sure I've missed something obvious.

Here's my mark-up:

<%@ Page Title="" Language="C#" MasterPageFile="~/Styles/Main.Master" AutoEventWireup="true" CodeBehind="Test.aspx.cs" Inherits="Pembs1.Pages.Test" %>
<asp:Content ID="Content1" ContentPlaceHolderID="cphHead" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="cphBody" runat="server">
<div id="PageContent">
    <ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server"></ajaxToolkit:ToolkitScriptManager>
    <ajaxToolkit:Accordion ID="accTest" runat="server" TransitionDuration="150">
        <Panes>
            <ajaxToolkit:AccordionPane runat="server" ID="apnTest1">
                <Header>
                    Test Head 1
                </Header>
                <Content>
                    Test Content 1
                </Content>
            </ajaxToolkit:AccordionPane>
            <ajaxToolkit:AccordionPane runat="server" ID="apnTest2">
                <Header>
                    Test Head 2
                </Header>
                <Content>
                    Test Content 2
                </Content>
            </ajaxToolkit:AccordionPane>
        </Panes>
    </ajaxToolkit:Accordion>

</div>
</asp:Content>

Any help is greatly appreciated.

Many thanks

Jubbs

hovermenuextender and callbacks

$
0
0

Hi gang

I have a gridview with hovermenuextender in each row - thats all working quite good...

but im missing something... 

I need a callback when the popup panel becomes visible (prefered method)

is this possible?

thanks

GridView Filter between 2 dates

$
0
0

I am trying to search for records in my gridview that are between 2 dates, and I can't figure out what I'm doing wrong.  When I search by Description, I click on the Description in the dropdownlist and the records filter right away.  I enter the 2 dates, and it does not filter.  Can you please tell me what I am doing wrong?  Here is my code:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/site.master" CodeBehind="TimeOffAllByUser.aspx.vb" Inherits="timework.TimeOffAllByUser" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"><asp:GridView ID="GridView1" runat="server" 
        DataSourceID="SqlDataSource1" AutoGenerateColumns="False" CellPadding="4" 
        ForeColor="#333333" GridLines="None" style="margin-right: 0px" 
        AllowPaging="True" AllowSorting="True"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:BoundField DataField="EmployeeName" HeaderText="Name" 
                ItemStyle-Width="150px"
                SortExpression="EmployeeName" /><asp:BoundField DataField="BeginDateOff" HeaderText="Begin Date" 
                DataFormatString="{0:d}" 
                SortExpression="BeginDateOff" /><asp:BoundField DataField="EndDateOff" HeaderText="End Date" 
                DataFormatString="{0:d}" 
                SortExpression="EndDateOff" /><asp:CheckBoxField DataField="AllDay_YesNo" HeaderText="All Day?" 
                ItemStyle-HorizontalAlign="Center"
                SortExpression="AllDay_YesNo" /><asp:BoundField DataField="BeginTimeOff" HeaderText="Begin Time"
                 DataFormatString="{0:t}" 
                SortExpression="BeginTimeOff" /><asp:BoundField DataField="EndTimeOff" HeaderText="End Time" 
                DataFormatString="{0:t}" 
                SortExpression="EndTimeOff" /><asp:CheckBoxField DataField="Approved" HeaderText="Approved" 
                ItemStyle-HorizontalAlign="Center"
                SortExpression="Approved" /><asp:BoundField DataField="Description" HeaderText="Reason" 
                 ItemStyle-Width="150px"
                SortExpression="Description" /></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /><SortedAscendingCellStyle BackColor="#E9E7E2" /><SortedAscendingHeaderStyle BackColor="#506C8C" /><SortedDescendingCellStyle BackColor="#FFFDF8" /><SortedDescendingHeaderStyle BackColor="#6F8DAE" /></asp:GridView><asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TimeSQLConnectionString1 %>" 
        SelectCommand="SELECT tblWorkHours.EmployeeName, tblWorkHours.BeginDateOff, tblWorkHours.EndDateOff, tblWorkHours.AllDay_YesNo, tblWorkHours.BeginTimeOff, tblWorkHours.EndTimeOff, tblWorkHours.Approved, tblCodesWork.Description, tblEmployees.Login FROM tblWorkHours INNER JOIN tblCodesWork ON tblWorkHours.WorkCode = tblCodesWork.WorkCodeID INNER JOIN tblEmployees ON tblWorkHours.Employee = tblEmployees.EmployeeID WHERE (tblEmployees.Login = @username) ORDER BY tblWorkHours.BeginDateOff DESC" 
        OnSelecting="SqlDataSource1_Selecting"
        FilterExpression="Description='{0}'"><SelectParameters><asp:QueryStringParameter Name="username"  /></SelectParameters><FilterParameters><asp:ControlParameter Name="Description" ControlId="fltrdesc" PropertyName="SelectedValue"/></FilterParameters></asp:SqlDataSource>
    Time Off Reason:&nbsp;<asp:DropDownList ID="fltrdesc" runat="server"  
        Height="26px" Width="135px" style="text-align: center" 
        DataSourceID="SqlDataSource2" DataTextField="Description" 
        DataValueField="Description" AutoPostBack="True" ></asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TimeSQLConnectionString1 %>" 
        SelectCommand="SELECT [Description] FROM [tblCodesWork] ORDER BY [Description]"></asp:SqlDataSource>&nbsp;<asp:ToolkitScriptManager ID="toolkitScriptManager" runat="server" /><br /> 
        Search for Time Off For&nbsp;<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True"></asp:TextBox><ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" 
        Enabled="True" TargetControlID="TextBox1"/>&nbsp;<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True"></asp:TextBox><ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" 
         Enabled="True" TargetControlID="TextBox2"/><asp:SqlDataSource ID="SqlDataSource4" runat="server" 
        ConnectionString="<%$ ConnectionStrings:TimeSQLConnectionString1 %>" 
        SelectCommand="SELECT tblWorkHours.EmployeeName, tblWorkHours.BeginDateOff, tblWorkHours.EndDateOff, tblWorkHours.AllDay_YesNo, tblWorkHours.BeginTimeOff, blWorkHours.EndTimeOff, tblWorkHours.Approved, tblCodesWork.Description, tblEmployees.Login 
            FROM tblWorkHours INNER JOIN tblCodesWork ON tblWorkHours.WorkCode = tblCodesWork.WorkCodeID INNER JOIN tblEmployees 
            ON tblWorkHours.Employee = tblEmployees.EmployeeID 
            WHERE (tblEmployees.Login = @username) and (CAST(BeginDateOff as Date) >= TextBox1) AND (CAST(EndDateOff as Date) <= TextBox2)
            ORDER BY tblWorkHours.BeginDateOff DESC" 
        OnSelecting="SqlDataSource1_Selecting"
        FilterExpression="BeginDateOff='{0}' and EndDateOff='{1}"><SelectParameters><asp:QueryStringParameter Name="username"  /></SelectParameters><FilterParameters><asp:ControlParameter Name="BeginDateOff" ControlId="TextBox1" Type="DateTime" PropertyName="Text"/><asp:ControlParameter Name="EndDateOff" ControlID="TextBox2" Type="DateTime" PropertyName="Text"/></FilterParameters></asp:SqlDataSource>&nbsp;<asp:Button ID="btnClear" runat="server" onclick="btnClear_Click" Text="Clear" /><br /> </asp:Content>

Thanks in advance!

MVC 5 Ajax.BeginForm everything in place including needed libraries to UpdateTarget X but entire page posted anyway

$
0
0

Hi,

I got an MVC 5 view which I'm using Ajax.BeginForm which is as follow :

@using (Ajax.BeginForm("Index", "DrugAdministration", new AjaxOptions() { HttpMethod = "GET", InsertionMode = InsertionMode.Replace, UpdateTargetId = "DispillsView" }))

The libraries are Render via the BundleConfig so here's my bundle :

bundles.Add(new ScriptBundle("~/bundles/FADM").Include("~/Scripts/CustomScripts/jquery-{version}.js","~/Scripts/CustomScripts/jquery-ui*","~/Scripts/CustomScripts/jquery-unobstrusive*","~/Scripts/CustomScripts/jquery-validation*","~/Scripts/CustomScripts/jquery.kinetic.min.js","~/Scripts/CustomScripts/jquery.smoothTouchScroll.min.js","~/Scripts/CustomScripts/jquery-ui-touch.js","~/Scripts/CustomScripts/modernizr-*", // ready for produc"~/Scripts/CustomScripts/bootstrap.js","~/Scripts/CustomScripts/respond.js"

Now when the form is posted, it is suppose to refresh only my Partial view since in my controller I have the following code :

if (Request.IsAjaxRequest())
    return PartialView("_Dispills", DrugAdmin);

However the IsAjaxRequest() is never true !

FIltering SQL Database results between 2 dates using Ajax Calendar extender

$
0
0

Hi All,

with the below code I am trying to select the number of unique visits by IP address between a date to another using Ajax Calendar extender but it doesn't work:

(P.S. the query does work if I use it in the query functionality of SSMS 2014):

<asp:Label ID="Label1" runat="server" Text="Start Date"></asp:Label><asp:TextBox ID="StartDateTextBox" runat="server"></asp:TextBox><cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="StartDateTextBox" Format="dd/MM/yyyy" Enabled="True"></cc1:CalendarExtender><asp:Label ID="Label2" runat="server" Text="End Date"></asp:Label><asp:TextBox ID="EndDateTextBox" runat="server"></asp:TextBox> <cc1:CalendarExtender ID="CalendarExtender2" runat="server" TargetControlID="EndDateTextBox" Format="dd/MM/yyyy" Enabled="True"></cc1:CalendarExtender><asp:Button ID="showbtn" runat="server" Text="Button" onclick="showvisits"/><asp:Label ID="uniquevisits" runat="server" Text=""></asp:Label><asp:Label ID="failure" runat="server" Text=""></asp:Label>

In code behind:

 Protected Sub showvisits(sender As Object, e As EventArgs) Handles showbtn.Click
        Dim conn As New SqlConnection(ConfigurationManager.ConnectionStrings("DefaultConnection").ConnectionString)
        Try
            conn.Open()
            Dim cmd As New SqlCommand("SELECT COUNT (DISTINCT VisitIp) FROM IpStorage WHERE VisitDate BETWEEN '@StartDate' AND '@EndDate')", conn)
            cmd.Parameters.AddWithValue("@StartDate", DateTime.Parse(StartDateTextBox.Text))
            cmd.Parameters.AddWithValue("@EndDate", DateTime.Parse(EndDateTextBox.Text))
            Dim myReader As SqlDataReader = cmd.ExecuteReader()
            While myReader.Read()
                uniquevisits.Text = myReader("VisitIp").ToString()
            End While
            myReader.Close()
        Catch ex As SqlException
            failure.Text = "ERROR"
        Finally
            conn.Close()
        End Try
    End Sub

Do you know what's wrong with the above code?

No particular errors is thrown but the error message that I implemented above.

Thanks

UpdatePanel - Input string was not in a correct format

$
0
0

I have a simple function to expand/contract a div in an update panel to show/hide the edit controls on a page:

protectedvoid btnExpand_Click(object sender,ImageClickEventArgs e){

divControls.Visible = !divControls.Visible;

}

most of the time it works, maybe 95%, but sometimes I get that error "Input string was not in a correct format".  If I try to handle the error withOnAsyncPostBackError="ScriptManager1_AsyncPostBackError" , I can grab more info but I have no idea where the error is:
source: mscorlib 
stack trace: at System.Number.StringToNumber(String str, NumberStyles options, NumberBuffer& number, NumberFormatInfo info, Boolean parseDecimal) at System.Number.ParseInt32(String s, NumberStyles style, NumberFormatInfo info) at System.Int32.Parse(String s, IFormatProvider provider) at System.Web.UI.WebControls.ImageButton.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.WebControls.ImageButton.System.Web.UI.IPostBackDataHandler.LoadPostData(String postDataKey, NameValueCollection postCollection) at System.Web.UI.Page.ProcessPostData(NameValueCollection postData, Boolean fBeforeLoad) at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
targetsite: {Void StringToNumber(System.String, System.Globalization.NumberStyles, NumberBuffer ByRef, System.Globalization.NumberFormatInfo, Boolean)}

 it may be an issue with trying to start a new request before finishing the last request.  Any ideas?


Gridview with Multiple Search Criteria - Only Search for Criteria that isn't Blank

$
0
0

I have a webpage with a Gridview.  At the bottom of the page, I have several search fields.  The first one is Reason which has a dropdownlist that comes from a SQL table.  The second and third fields are for to and from dates that have calendar extenders.  I would like the ability to search either by Reason, To and From Dates, or both Reason and To and From Dates.  Right now, I have to enter the Reason, and the to and from dates before it will search.  It searches when I add the last variable - I do not have a button.  Here is my code:

<%@ Page Title="" Language="vb" AutoEventWireup="false" MasterPageFile="~/site.master" CodeBehind="TimeOffAllByUser.aspx.vb" Inherits="timework.TimeOffAllByUser" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="asp" %><asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server"><style type="text/css">
        .style1
        {
            font-family: "Segoe UI";
            font-weight: bold;
            font-size: medium;
        }</style></asp:Content><asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server"><asp:GridView ID="GridView1" runat="server" 
        DataSourceID="SqlDataSource1" AutoGenerateColumns="False" CellPadding="4" 
        ForeColor="#333333" GridLines="None" style="margin-right: 0px" 
        AllowPaging="True" AllowSorting="True" Height="419px"><AlternatingRowStyle BackColor="White" ForeColor="#284775" /><Columns><asp:BoundField DataField="EmployeeName" HeaderText="Name" 
                ItemStyle-Width="150px"
                SortExpression="EmployeeName" /><asp:BoundField DataField="BeginDateOff" HeaderText="Begin Date" 
                DataFormatString="{0:d}" 
                SortExpression="BeginDateOff" /><asp:BoundField DataField="EndDateOff" HeaderText="End Date" 
                DataFormatString="{0:d}" 
                SortExpression="EndDateOff" /><asp:CheckBoxField DataField="AllDay_YesNo" HeaderText="All Day?" 
                ItemStyle-HorizontalAlign="Center"
                SortExpression="AllDay_YesNo" /><asp:BoundField DataField="BeginTimeOff" HeaderText="Begin Time"
                 DataFormatString="{0:t}" 
                SortExpression="BeginTimeOff" /><asp:BoundField DataField="EndTimeOff" HeaderText="End Time" 
                DataFormatString="{0:t}" 
                SortExpression="EndTimeOff" /><asp:CheckBoxField DataField="Approved" HeaderText="Approved" 
                ItemStyle-HorizontalAlign="Center"
                SortExpression="Approved" /><asp:BoundField DataField="Description" HeaderText="Reason" 
                 ItemStyle-Width="150px"
                SortExpression="Description" /></Columns><EditRowStyle BackColor="#999999" /><FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" /><PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" /><RowStyle BackColor="#F7F6F3" ForeColor="#333333" /><SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" /><SortedAscendingCellStyle BackColor="#E9E7E2" /><SortedAscendingHeaderStyle BackColor="#506C8C" /><SortedDescendingCellStyle BackColor="#FFFDF8" /><SortedDescendingHeaderStyle BackColor="#6F8DAE" /></asp:GridView><asp:Panel ID="Panel1" runat="server" BorderColor="#666666" BorderStyle="Solid" Width="802px"><span class="style1"><br /> &nbsp; Search for:</span><br /><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Time Off Reason:  <asp:DropDownList ID="fltrdesc" runat="server"  
            Height="26px" Width="135px" style="text-align: center" 
            DataSourceID="SqlDataSource2" DataTextField="Description" 
            DataValueField="Description" AutoPostBack="True" ></asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TimeSQLConnectionString1 %>" 
            SelectCommand="SELECT [Description] FROM [tblCodesWork] ORDER BY [Description]"></asp:SqlDataSource><br /><asp:ToolkitScriptManager ID="toolkitScriptManager" runat="server" /><br /> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Time Off Between: &nbsp;<asp:TextBox ID="TextBox1" runat="server" AutoPostBack="True" Height="25px" 
            Width="110px"></asp:TextBox><ajaxToolkit:CalendarExtender ID="CalendarExtender1" runat="server" 
            Enabled="True" TargetControlID="TextBox1"/>&nbsp;<asp:TextBox ID="TextBox2" runat="server" AutoPostBack="True" Height="25px" 
            Width="110px"></asp:TextBox><ajaxToolkit:CalendarExtender ID="CalendarExtender2" runat="server" 
             Enabled="True" TargetControlID="TextBox2"/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<asp:Button ID="btnClear" runat="server" onclick="btnClear_Click" Text="Clear" /><asp:SqlDataSource ID="SqlDataSource1" runat="server" 
            ConnectionString="<%$ ConnectionStrings:TimeSQLConnectionString1 %>" 
            SelectCommand="SELECT tblWorkHours.EmployeeName, tblWorkHours.BeginDateOff, tblWorkHours.EndDateOff, tblWorkHours.AllDay_YesNo, tblWorkHours.BeginTimeOff, tblWorkHours.EndTimeOff, tblWorkHours.Approved, tblCodesWork.Description, tblEmployees.Login FROM tblWorkHours INNER JOIN tblCodesWork ON tblWorkHours.WorkCode = tblCodesWork.WorkCodeID INNER JOIN tblEmployees ON tblWorkHours.Employee = tblEmployees.EmployeeID WHERE (tblEmployees.Login = @username) ORDER BY tblWorkHours.BeginDateOff DESC" 
            OnSelecting="SqlDataSource1_Selecting"
            FilterExpression="Description='{0}' and BeginDateOff >= '{1}' AND EndDateOff <= '{2}'"><SelectParameters><asp:QueryStringParameter Name="username"  /></SelectParameters><FilterParameters><asp:ControlParameter ControlId="fltrdesc" Name="Description" PropertyName="Text" Type="String" /><asp:ControlParameter ControlID="TextBox1" Name="BeginDateOff" PropertyName="Text" Type="String" /><asp:ControlParameter ControlID="TextBox2" Name="enddateOff" PropertyName="Text" Type="String" /></FilterParameters></asp:SqlDataSource><br /><br /></asp:Panel><br /><br /></asp:Content>

And here is my VB code:

Imports System
Imports System.Data
Imports System.Data.OleDb
Imports System.Data.SqlClient
Imports System.Configuration
Imports System.Web.Mvc
Public Class TimeOffAllByUser
    Inherits System.Web.UI.Page

    Protected Sub SqlDataSource1_Selecting(ByVal sender As Object, ByVal e As SqlDataSourceSelectingEventArgs)

        Dim vusername() As String
        vusername = Split(HttpContext.Current.User.Identity.Name, "\", , CompareMethod.Text)
        e.Command.Parameters("@username").Value = vusername(1)

    End Sub

    Protected Sub btnClear_Click(ByVal sender As Object, ByVal e As EventArgs) Handles btnClear.Click

        'Clear Description (Reason for Time Off) field

        SqlDataSource1.FilterExpression = ""
        SqlDataSource1.DataBind()
        'Redirect to same page again
        Response.Redirect(HttpContext.Current.Request.Url.ToString(), True)

    End Sub

End Class

Thanks in advance for your help!

Toolkit not working

$
0
0

I started a new website and added AjaxControlToolkit.dll to my bin folder.  I also installed it in Visual Studio (and it works in other websites).  I am getting the error below but do not know how to get it to work. Thanks.

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

 Stack Trace:
   at AjaxControlToolkit.ToolkitScriptManagerCombiner.OutputCombinedScriptFile(HttpContextBase context)
   at AjaxControlToolkit.ToolkitScriptManager.OnInit(EventArgs e) in f:\TeamCity\buildAgent\work\80acd78aa4c25314\Server\AjaxControlToolkit\ToolkitScriptManager\ToolkitScriptManager.cs:line 192
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Control.InitRecursive(Control namingContainer)
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)

JavaScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts

$
0
0

I have an aspx page using ajax controls that is raising the exception...

Unhandled exception at line 22, column 5 in http://localhost:62516/ScriptResource.axd?d=HmPHS4c8DJOsyehLgTYT9F7Yw-

pybbFVxd14IJQsGAUER3poUaD5XAtYL_UUq9usm4Hzq_ZhnpBrOYV_cxmUbhJGvaAEu5CfGtEISj2PMfC-DXQuOU5r7NLIdquzm0O50&t=ffffffffda74082d

0x800a139e - JavaScript runtime error: AjaxControlToolkit requires ASP.NET Ajax 4.0 scripts. Ensure the correct version of the scripts are referenced. If you are using

an ASP.NET ScriptManager, switch to the ToolkitScriptManager in AjaxControlToolkit.dll.

...when I run it in debug.  When I use the continue button the next exception is...

unhandled exception at line 1142, column 1 in http://localhost:62516/ScriptResource.axd?d=OFchIa8TEHI7HoGbRKmleS6dNot_Dp5NIQqtHyGVGacFXUIUJ-ZZcIKXONVaD22Bc97LUP0ZI-

vh7818xA7dqolQD6ZWwYTagCXbDJm9k_iWO2lVYlCrGvYtQw5YDt2vgfGwXshTyOojGC6010mwMQ2&t=ffffffffda74082d

0x800a01b6 - JavaScript runtime error: Object doesn't support property or method 'registerComponent'

I tried updating my NuGet packages through <tools><library package manager><manage nuget packages for solution> and also cleaning out the bin folder in my project

before running the page in debug but get the same result.  My web.config looks like...

<?xml version="1.0" encoding="utf-8"?> <!--   For more information on how to configure your ASP.NET application, please visit  http://go.microsoft.com/fwlink/?LinkId=169433  --> <configuration>   <configSections>     <!-- For more information on Entity Framework configuration, visithttp://go.microsoft.com/fwlink/?LinkID=237468 -->

    <section name="entityFramework" type="System.Data.Entity.Internal.ConfigFile.EntityFrameworkSection, EntityFramework, Version=6.0.0.0, Culture=neutral,

PublicKeyToken=b77a5c561934e089" requirePermission="false" />   </configSections>   <connectionStrings>     <add name="a06DBconnection" connectionString="Data Source=DBNAMETEST-WEB\DBNAMETESTWEB;Integrated Security=True;Connect

Timeout=15;Encrypt=False;TrustServerCertificate=False;Initial Catalog=CATNAME;" providerName="System.Data.SqlClient" />   </connectionStrings>   <system.web>     <authentication mode="None" />     <customErrors mode="Off" />     <compilation debug="true" targetFramework="4.5">       <assemblies>         <add assembly="System.Data.Services.Client, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C934E089" />         <add assembly="System.DirectoryServices.AccountManagement, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A5C934E089" />         <add assembly="System.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F1D50A3A" />         <add assembly="System.Web.Extensions.Design, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31BFD364E35" />        <add assembly="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B77A534E089" />       </assemblies>     </compilation>     <httpRuntime targetFramework="4.5" />     <pages enableEventValidation="false">       <namespaces>         <add namespace="System.Web.Optimization" />         <add namespace="Microsoft.AspNet.Identity" />       </namespaces>       <controls>                 <add tagPrefix="ajaxToolkit" assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" />       <add assembly="Microsoft.AspNet.Web.Optimization.WebForms" namespace="Microsoft.AspNet.Web.Optimization.WebForms" tagPrefix="webopt" /></controls>     </pages>     <membership>       <providers>         <!--         ASP.NET Membership is disabled in this template. Please visit the following linkhttp://go.microsoft.com/fwlink/?LinkId=301889 to learn about the ASP.NET

Membership support in this template         -->         <clear />       </providers>     </membership>     <profile>       <providers>         <!--         ASP.NET Membership Profile is disabled in this template. Please visit the following linkhttp://go.microsoft.com/fwlink/?LinkId=301889 to learn about the

ASP.NET Membership support in this template         -->         <clear />       </providers>     </profile>     <roleManager>       <!--           ASP.NET Membership Role is disabled in this template. Please visit the following linkhttp://go.microsoft.com/fwlink/?LinkId=301889 to learn about the

ASP.NET Membership support in this template         -->       <providers>         <clear />       </providers>     </roleManager>     <!--             If you are deploying to a cloud environment that has multiple web server instances,             you should change session state mode from "InProc" to "Custom". In addition,             change the connection string named "DefaultConnection" to connect to an instance             of SQL Server (including SQL Azure and SQL  Compact) instead of to SQL Server Express.      -->     <sessionState mode="InProc" customProvider="DefaultSessionProvider">       <providers>         <add name="DefaultSessionProvider" type="System.Web.Providers.DefaultSessionStateProvider, System.Web.Providers, Version=1.0.0.0, Culture=neutral,

PublicKeyToken=31bf38564e35" connectionStringName="DefaultConnection" />       </providers>     </sessionState>   </system.web>   <runtime>     <assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">       <dependentAssembly>         <assemblyIdentity name="WebGrease" culture="neutral" publicKeyToken="31bf3ad364e35" />         <bindingRedirect oldVersion="0.0.0.0-1.6.5135.21930" newVersion="1.6.5135.21930" />       </dependentAssembly>       <dependentAssembly>         <assemblyIdentity name="Microsoft.WindowsAzure.Storage" publicKeyToken="31bf3856a4e35" culture="neutral" />         <bindingRedirect oldVersion="0.0.0.0-2.1.0.4" newVersion="2.1.0.4" />       </dependentAssembly>       <dependentAssembly>         <assemblyIdentity name="HtmlAgilityPack" publicKeyToken="bd319b1f3b43a" culture="neutral" />         <bindingRedirect oldVersion="0.0.0.0-1.4.9.0" newVersion="1.4.9.0" />       </dependentAssembly>       <dependentAssembly>         <assemblyIdentity name="Antlr3.Runtime" publicKeyToken="eb42606e9261f" culture="neutral" />        <bindingRedirect oldVersion="0.0.0.0-3.5.0.2" newVersion="3.5.0.2" />       </dependentAssembly>       <dependentAssembly>         <assemblyIdentity name="AjaxMin" publicKeyToken="21ef50ced80f" culture="neutral" />         <bindingRedirect oldVersion="0.0.0.0-5.14.5506.26196" newVersion="5.14.5506.26196" />       </dependentAssembly>     </assemblyBinding>   </runtime>   <entityFramework>     <defaultConnectionFactory type="System.Data.Entity.Infrastructure.LocalDbConnectionFactory, EntityFramework">       <parameters>        <parameter value="v11.0" />       </parameters>     </defaultConnectionFactory>     <providers>       <provider invariantName="System.Data.SqlClient" type="System.Data.Entity.SqlServer.SqlProviderServices, EntityFramework.SqlServer" />     </providers>   </entityFramework></configuration>

Can someone kindly show me what I need to do to get this to work?  If I'm missing something fundimental please excuse I'm a newbie to Ajax and to .net in general. 

Thanks tonnes for any help, Roscoe

Ajax Control Toolkit Won't Run in Medium Trust

$
0
0

I see a number of postings online that Ajax Control Toolkit will not work under medium trust hosting environments.

Has anyone figured out how to get the Ajax Control Toolkit to work under MEDIUM TRUST?

Display "Process Completed" Message in UpdateProgress.

$
0
0

Hello

I've Image button in my GridView and when user clickling this ImageButton opening Panel with AjaxModalPopUp Extender.

In ModalPopUp I've UpdateProgress. 

User clicking ok button then UpdateProgress starting display a gif. 

I want to display "Completed" message at the end of OnClikEvent. 

When I debugging, simply watching in debugger that Label control changing message but in the browser doesnt change anything.

Any help?

//aspx<tr style="height: 30px;"><td><asp:UpdateProgress ID="updProgress" runat="server" DynamicLayout="true" AssociatedUpdatePanelID="UpdatePanelModalPopUpButtons"><ProgressTemplate>                                                            <div class="progress"><asp:Label runat="server" ID="LabelProgress" Text="Talep gönderiliyor." ></asp:Label></div><div class="progress"><asp:Image runat="server" alt="" style="vertical-align: middle;" src="/Images/ajax-loaderimg.gif"  /> </div></ProgressTemplate></asp:UpdateProgress></td></tr><tr align="center"><td><asp:UpdatePanel runat="server" ID="UpdatePanelModalPopUpButtons"><ContentTemplate><asp:Button ID="btnAddToCart"
                                                                runat="server" Text="Evet"
                                                                OnClick="ButtonSendStoneRequest_Click" Width="100px"
                                                                OnClientClick="this.disabled=true;" UseSubmitBehavior="false" /><asp:LinkButton ID="btnClose" runat="server" Text="Kapat" Width="100px" ForeColor="Navy" OnClientClick="return HideModalPopup()" /></td>                                            </ContentTemplate></asp:UpdatePanel></tr>
//cs
 protected void ButtonSendStoneRequest_Click(object sender, EventArgs e)
    {        
        btnAddToCart.Enabled = false;
//sending email
//
//
        btnAddToCart.Enabled = true;

        
        ((Label)updProgress.FindControl("LabelProgress")).Text = "Whatever you want it to say.";
        System.Threading.Thread.Sleep(5000);
        ModalPopupExtender1.Hide();        
    }

Viewing all 5678 articles
Browse latest View live




Latest Images