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

Accordion works on Development server but not on Production server?

$
0
0

Hi Guys,

I added an accordion to a few of my web forms, with the script manager on the master page and the proxies on the relevant content pages. When I run the site on my ASP.net Development server, the AJAX controls work fine, but once uploaded to the production server... nothing.

Are there specific settings that I need to change for AJAX controls to work on production servers as well?

I am using VS 2012 Express and SQL Server Express for my DB...


How can I upload multiple files by using AsyncfileUpload ?

$
0
0

I want it to be worked as same as how asp:fileupload with multiple files upload at the same time,

but sadly i can only use asyncfileupload, many thanks.

AjaxToolKit Issues in Modal Popup in IE 10

$
0
0

I have a following implementation in an asp.net application.

In abc.aspx i have this tag:

<ajaxToolkit ModalPopUpExtender popupControId="pnl"><asp:Panel id="pnl"><iframe src="example.aspx" id="fr2"></asp:Panel>




Now the example.aspx has a PopUp Control Extender as like this

<asp:Textbox id="txt"><asp:UpdatePanel id=udp><ContentTemplate><asp:Button/><asp:CheckBoxList><asp:Button/> .</ContentTemplate></asp:UpdatePanel><ajaxToolkit:PopUpControlExtender targetControlId="txt"></ajaxToolkit>


Now that PopupControlExtender in example.aspx runs fine when it is normally rendered as an aspx page.When the Page is Implemented as above in an iframe,in IE10, the PopUp Control Extender Doesnot Work as Desired.But it Works Fine In compatibility modes of IE as Well as Normal modes in Firefox,Chrome and Safari.


Please Help on this ..

I need help about AjaxFileUpload

$
0
0

Hi

I have spent more than 10 days looking for code for AjaxFileUpload  to use it with uploading images to folder and insert the image paht in database, and I could do this but my problem is updating Datalist after inserting the image, I don't want to refresh whole page, just refresh DataList only, I tryied many times to do this but I can't

please help me

this is my code

AJAXuploadimage.aspx

 

<%@PageLanguage="C#"AutoEventWireup="true"CodeFile="AJAXuploadimage.aspx.cs"Inherits="AJAXuploadimage" %>

<%@RegisterTagPrefix="act"Namespace="AjaxControlToolkit"Assembly="AjaxControlToolkit" %>

<!DOCTYPEhtml>

<htmlxmlns="http://www.w3.org/1999/xhtml">

<headrunat="server">  

<title></title>   

<styletype="text/css">       

.auto-style1 {           

width:100%;

        }

 

</style>

</head>

<body>

<formid="form1"runat="server">

<div>

<act:ToolkitScriptManagerID="tsm"runat="server"/>

<br/><br/>

 

<act:AsyncFileUpload

ID="AsyncFileUpload1"

ThrobberID="throbber"

UploadingBackColor="yellow"      

ErrorBackColor="red"

CompleteBackColor="green"     

UploaderStyle="Modern"       

PersistFile="true"       

runat="server"OnUploadedComplete="AsyncFileUpload1_UploadedComplete"    

OnClientUploadComplete="uploadComplete"OnClientUploadCompleteAll="UploadCompleteAll" />

<asp:ImageID="throbber"ImageUrl="~/mainwebsiteimage/uploading.gif"

style="display:none"runat="server"/>

<br/>

<br/>

<asp:ImageID="imgLoader"runat="server"ImageUrl="~/images/loader.gif"/>

<br/><br/>        

 

<br/>

<br/>

<br/>

<br/>

        Updating DataList

<br/>

<br/>

<div>

<asp:UpdatePanelID="UpdatePanel1"runat="server">

<ContentTemplate>

<asp:DataListID="DataList1"runat="server">                   

<ItemTemplate>                   

<tableclass="auto-style1">                    

<tr>

<td>

<asp:LabelID="Label1"runat="server"Text='<%# Eval("id") %>'></asp:Label>

</td>

<td>

<asp:LabelID="Label2"runat="server"Text='<%# Eval("ImageName") %>'></asp:Label>

</td>

</tr>

<tr>

<tdcolspan="2"style="text-align: center">

<asp:ImageID="Image1"runat="server"ImageUrl='<%# Eval("ImageUrl") %>'style="text-align: left"Width="100px"/>

</td>

</tr>

</table>

</ItemTemplate>

</asp:DataList>

</ContentTemplate>

<Triggers>

<asp:AsyncPostBackTriggerControlID="AsyncFileUpload1"EventName="UploadedComplete"/>

</Triggers>

</asp:UpdatePanel>

</div>

</div>

</form>

</body>

</html>

 

 and this is

AJAXuploadimage.aspx.cs

 

using System;

using System.Collections.Generic;

using System.Linq;

using System.Web;

using System.Web.UI;

using System.Web.UI.WebControls;

using System.Xml.Linq;

using System.Data.SqlClient;

using System.Data;

using System.Configuration;

 

 

 

public partialclassAJAXuploadimage : System.Web.UI.Page

{

   SqlConnection conn = newSqlConnection(ConfigurationManager.ConnectionStrings["ConnectionString"].ToString());

   publicstring filename;

   publicstring Path;

   protectedvoid Page_Load(object sender, EventArgs e)

    {

       if (!IsPostBack)

        {

            BindGrid();

        }

    }

   

protectedvoid AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)

    {      

        System.Threading.Thread.Sleep(5000);

       if (AsyncFileUpload1.HasFile)

        {

            Path = ("~/uploads/"+ AsyncFileUpload1.FileName);

           AsyncFileUpload1.SaveAs(Server.MapPath(Path));

           string name = System.IO.Path.GetFileName(AsyncFileUpload1.PostedFile.FileName);

            HttpPostedFile AttachFile = AsyncFileUpload1.PostedFile;

           conn.Open();

           uploadComplete(Path);

            update();

            BindGrid();

       }

    }

 

   

publicint uploadComplete(string Path)

    {

       String copyData = "INSERT INTO [Images] (ImageName, ImageUrl) VALUES ('"+ Path +"', '"+ Path +"')";

      SqlCommand SECTION =newSqlCommand(copyData, conn);

       SqlCommand mySqlCommand = newSqlCommand("SELECT * FROM [Table] ORDER BY [Id] DESC", conn);

       SqlDataAdapter mySqlAdapter = newSqlDataAdapter(mySqlCommand);

       DataSet myDataSet = newDataSet();

        mySqlAdapter.Fill(myDataSet);

       return SECTION.ExecuteNonQuery();  

    }

   

public void BindGrid()

    {

     string Sql ="select * from Images order by Id desc";

     SqlDataAdapter da =newSqlDataAdapter(Sql, conn);

     DataSet ds =newDataSet();

        da.Fill(ds);

       DataList1.DataSource = ds;

      DataList1.DataBind();

   }

I want to get like this Ajax tool ready for using in this link

http://www.asp.net/ajaxLibrary/AjaxControlToolkitSampleSite/AjaxFileUpload/AjaxFileUpload.aspx 

JavaScript runtime error: "The data necessary to complete this operation is not yet available" and "No digits"

$
0
0

Exception was thrown at line 165, column 29 in http://localhost:30922/ScriptResource.axd?d=FHnC7y678QIZTuGLFowVOYb9WXj38cpJ_9S8zhqugNkFm8ttAnrl08J5YogLpq60qNGEZhIuyqpLZdp5s4iztG8JMGUbiFhjJy2PuxjKSlQ2i_PujcO3yCXcoPh5Ez5cZugeFw2&t=ffffffff886f56f4

0x8000000a - JavaScript runtime error: The data necessary to complete this operation is not yet available.

Hi there,

Hopefully this an easy one - something to do with DLL versions or something?!?

NOTE: In our environment I'm unable to use packagemanager (something to do with proxy/firewall stuff)

This doesn't APPEAR to be causing any issues (yet) and we don't think it was happening in vs2010 but now we are using vs2012 and when debugging we see lots of these messages every pageload in the OUTPUT window.... any thoughts/info is appreciated.

 

 

Exception was thrown at line 3, column 7032 in http://localhost:30922/ProductCategory.aspx?_TSM_HiddenField_=ctl00_ctl00_smMinteShop_HiddenField&_TSM_CombinedScripts_=;;AjaxControlToolkit,+Version=3.5.7.607,+Culture=neutral,+PublicKeyToken=28f01b0e84b6d53e:en-US:e96eec5b-f5fc-47c8-9cba-2a4f2f4c43f0:de1feab2:f9cec9bc:35576c48:f2c8e708:720a52bf:589eaa30:698129cf:e148b24b:8ad18101:7311d143

0x800a139e - JavaScript runtime error: No digits

ValidatorCalloutExtender and PopupPostion Exception

$
0
0

Has anyone seen this exception before and how did you solve it.

I have recently upgraded my site from a website to a webproject if this helps.

Also it is a .net 3.5 site.

validatorcalloutextender

Thanks in Advance

Scott

'WebForm_DoPostBackWithOptions' is undefined error in IE11

$
0
0

Dear all,

I deployed a webapplication which has ajax toolkit like tabs, update panel etc. It works fine in IE 10 ,Google chrome etc bt its not working in IE11. Tabs , Calendar click and all ajax features is not completely working in IE11. I have .Net framework 4.5. When i run it in local host it works but whereas after i deploy to the server it's not working. For some users it shows as  'WebForm_DoPostBackWithOptions' is undefined error. .Please let me know the solution for the same

Thanks

tabcontainervalidation

$
0
0

hi there

i created a tabcontainer that takes user input in 4 tabs and validatesome fields then  save it to different databases

i wana check the filled fields in tabs and save them

what happens now is that if a field has validator and its not filled the system give error and did not save the filed data

1) check only filled tab 

2)save only filled tabs

is that possible


How to access Content Page Without Page Reload of Masterpage using Updatepanel

$
0
0

Hi 

I am using masterpage.

In the left side, I have placed my Menu in vertical. I need to load the content page with out master page reload. Can we get it from UpdatePanel or any other way to get it?

<div class="FloatLft"><ul id="subMenu" class="SettingList"><li id="department"><a runat="server" href="Depart.aspx">Department</a></li><li id="Loaction"><a id="A8" runat="server" href="location.aspx">location</a></li><li id="allowance"><a id="A9" runat="server" href="Map.aspx">Map</a></li></ul></div><div> <asp:ScriptManager ID="ScriptManager2" runat="server" />    <asp:UpdatePanel ID="UpdatePanel2" runat="server"><ContentTemplate><fieldset><div class="FloatLft" style="margin: 0px 0px 0px 20px; width: 750px; min-height: 450px;"><asp:ContentPlaceHolder runat="server" ID="childMainContent"></asp:ContentPlaceHolder></div></fieldset></ContentTemplate></asp:UpdatePanel></div>

Repeater ItemCommand not firing from within ModalPopupExtender

$
0
0

I'm sure this has come up before, but I seem to keep finding the reverse (ModalPopupExtender (MPE) in Repeater), so here goes...

I have a single MPE in my base master page.  I have a image carousel user control that dynamically adds a image gallery editor control to the MPE when an edit link button is clicked.  the editor control has a repeater in it that shows the current list of images, link buttons for each image that move an image left & right (change the display order in the DB) & remove the image (delete from the DB), & a file upload, title textbox, & save button to add a new image.

The MPE works just fine (loads the editor), but when the move, remove, or save (link)buttons are cliked, the page refreshes w/ the MPE showing the editor, but nothing has changed.  when debugging, I can see that the repeater's ItemCommand & the save button's Click events are not being fired.

Here is the master page's HTML w/ the single MPE in it:

<%@ Master Language="C#" AutoEventWireup="true" CodeFile="base.master.cs" Inherits="masterpages_base" %><%@ Register TagPrefix="ic" TagName="UserStatus" Src="~/controls/UserStatus.ascx" %><%@ Register TagPrefix="ic" TagName="Footer" Src="~/controls/Footer.ascx" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="ic" %><!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 runat="server"><title></title><%-- --%><link type="text/css" rel="Stylesheet" href="../css/reset.css" /><link type="text/css" rel="stylesheet" href="http://fonts.googleapis.com/css?family=Ubuntu:500,regular&amp;subset=latin" media="all" /><link type="text/css" rel="Stylesheet" href="../css/styles.css" /><script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script><asp:ContentPlaceHolder id="cphGeneralHead" runat="server" /><%-- --%><link href="../css/blue.monday/jplayer.blue.monday1.css" rel="stylesheet" type="text/css" /><!--<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.6/jquery.min.js"></script>
    --><script type="text/javascript" src="../js/jquery.jplayer.js"></script><script type="text/javascript">
        //<![CDATA[
        $(document).ready(function () {
            $('#jquery_jplayer_1').jPlayer({
                ready: function (event) {
                    $(this).jPlayer('setMedia', {
                        mp3: 'tracks/<asp:Literal runat="server" id="litTrackFilename" />'
                    });
                },
                swfPath: '../js',
                supplied: 'mp3',
                wmode: 'window',
                preload: 'auto'
            });
        });

        function StopPlayer() {
            $("#jquery_jplayer_1").jPlayer("stop");
        }
        //]]></script><script type="text/javascript">
        function SaveTrack(textboxID, hiddenID) {
            var textbox = document.getElementById(textboxID);
            var hidden = document.getElementById(hiddenID);
            hidden.value = textbox.value;
            alert(hidden.value);
            document.forms[0].submit();
        }</script></head><body><a name="top"></a><form id="form1" runat="server"><%-- --%><asp:ScriptManager ID="ScriptManager1" runat="server" /><asp:Panel runat="server" ID="pnlPageWrapper"><div style="float:left;"><asp:HyperLink runat="server" ID="hypAdminLink" NavigateUrl="~/admin/home.aspx" Text="Admin" /></div><div id="user-status"><ic:UserStatus runat="server" ID="icUserStatus" /></div><div class="clear"><!-- --></div><div id="base-content"><asp:ContentPlaceHolder id="cphGeneral" runat="server" /></div><div id="footer"><ic:Footer runat="server" ID="icFooter" /></div></asp:Panel><%-- --%><asp:Button ID="btnMPEDummy" runat="server" Text="Button" Style="display: none" /><ic:ModalPopupExtender
    ID="mpeContainer"
    runat="server"
    backgroundcssclass="modalBackground"
    Enabled="True"
    TargetControlID="btnMPEDummy"
    PopupControlID="pnlMPE" /><asp:Panel runat="server" ID="pnlMPE" CssClass="modalPopup"><asp:ImageButton runat="server" ID="ibClose" ImageUrl="~/images/ui/player_close.png" OnClick="ibClose_Click" CssClass="close-button" /><div class="clear-bottom-15"><!-- --></div><asp:Panel runat="server" ID="pnlContainer" /></asp:Panel></form></body></html>

Here is the ascx for the ImageLightboxCarousel user control:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ImageLightboxCarousel.ascx.cs" Inherits="controls_ImageLightboxCarousel" %><%@ Reference Control="~/controls/ImageGalleryEditor.ascx" %><script type='text/javascript' language='javascript'>
    tb_pathToImage = '../images/ui/loading-thickbox.gif';

    jQuery(document).ready(function () {
        jQuery('#<asp:Literal runat="server" ID="litCarouselID1" />').jcarousel();
    });</script><div id="image-lightbox-carousel"><asp:LinkButton runat="server" ID="lbEditImageGallery" CssClass="edit-image-gallery" onclick="lbEditImageGallery_Click" ToolTip="Edit Image Gallery" /><div class="clear"><!-- --></div><ul id='<asp:Literal runat="server" ID="litCarouselID2" />' class='jcarousel-skin-ie7'><asp:Repeater runat="server" ID="rptImages" onitemdatabound="rptImages_ItemDataBound" OnItemCommand="rptImages_ItemCommand"><ItemTemplate><li>                <asp:LinkButton runat="server" ID="lbFull"><asp:Image runat="server" ID="imgThumb" Width="95px" Height="67px" /></asp:LinkButton></li></ItemTemplate></asp:Repeater></ul></div>



Here is the cs for the ImageLightboxCarousel user control:

using System;
using System.Web.UI.WebControls;
using System.Collections.Generic;
using AjaxControlToolkit;

public partial class controls_ImageLightboxCarousel : BaseControl
{
    protected controls_ImageGalleryEditor icImageGalleryEditor = new controls_ImageGalleryEditor();

    protected int ViewedUserID
    {
        get
        {
            return String.IsNullOrWhiteSpace(Request.QueryString["uid"])
                ? 0
                : Convert.ToInt32(Request.QueryString["uid"]);
        }
    }

    protected DBUser ViewedUser = null;

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (ViewedUserID < 1)
        {
            Response.Redirect(ResolveUrl("~/Home.aspx"));
        }

        ViewedUser = DBUser.GetUserByID(ViewedUserID);

        if (Session["ShowEditImageGalleryLightbox"] != null)
        {
            try
            {
                bool showEditImageGalleryLightbox = Convert.ToBoolean(Session["ShowEditImageGalleryLightbox"]);
                if (showEditImageGalleryLightbox)
                {
                    ModalPopupExtender mpeContainer = Page.Master.Master.FindControl("mpeContainer") as ModalPopupExtender;
                    Panel pnlContainer = Page.Master.Master.FindControl("pnlContainer") as Panel;
                    pnlContainer.Controls.Clear();

                    icImageGalleryEditor = LoadControl("~/controls/ImageGalleryEditor.ascx") as controls_ImageGalleryEditor;
                    icImageGalleryEditor.ID = "icImageGalleryEditor";
                    pnlContainer.Controls.Add(icImageGalleryEditor);

                    mpeContainer.Show();
                }
            }
            catch (Exception ignored) { }
        }

        return;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        litCarouselID1.Text = "image-gallery-carousel";
        litCarouselID2.Text = "image-gallery-carousel";

        rptImages.DataSource = ViewedUser.Images;
        rptImages.DataBind();

        lbEditImageGallery.Visible = (TheUser.ID == ViewedUserID);

        return;
    }

    protected void rptImages_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        RepeaterItem item = e.Item;
        if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
        {
            DBImage image = item.DataItem as DBImage;
            LinkButton lbFull = item.FindControl("lbFull") as LinkButton;
            Image imgThumb = item.FindControl("imgThumb") as Image;

            lbFull.ToolTip = image.Title;
            lbFull.CommandArgument = image.ID.ToString();
            imgThumb.ImageUrl = ResolveUrl(String.Format("~/users/{0}/gallery/thumb/{1}", ViewedUser.ID, image.Filename));
            imgThumb.AlternateText = image.Title;
        }

        return;
    }

    protected void rptImages_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        int id = Convert.ToInt32(e.CommandArgument);
        DBImage item = new DBImage();
        foreach (DBImage image in ViewedUser.Images)
        {
            if (image.ID == id)
            {
                item = image;
            }
        }

        ModalPopupExtender mpeContainer = Page.Master.Master.FindControl("mpeContainer") as ModalPopupExtender;
        Panel pnlContainer = Page.Master.Master.FindControl("pnlContainer") as Panel;
        pnlContainer.Controls.Clear();

        Image imgFullImage = new Image();
        imgFullImage.ImageUrl = ResolveUrl(String.Format("~/users/{0}/gallery/full/{1}", ViewedUser.ID, item.Filename));
        pnlContainer.Controls.Add(imgFullImage);

        mpeContainer.Show();

        return;
    }

    protected void lbEditImageGallery_Click(object sender, EventArgs e)
    {
        ModalPopupExtender mpeContainer = Page.Master.Master.FindControl("mpeContainer") as ModalPopupExtender;
        Panel pnlContainer = Page.Master.Master.FindControl("pnlContainer") as Panel;
        pnlContainer.Controls.Clear();

        icImageGalleryEditor = LoadControl("~/controls/ImageGalleryEditor.ascx") as controls_ImageGalleryEditor;
        icImageGalleryEditor.ID = "icImageGalleryEditor";
        pnlContainer.Controls.Add(icImageGalleryEditor);

        Session["ShowEditImageGalleryLightbox"] = true;
        mpeContainer.Show();

        return;
    }
}

Here is the ascx for the ImageGalleryEditor user control:

<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ImageGalleryEditor.ascx.cs" Inherits="controls_ImageGalleryEditor" %><div id="image-gallery-editor"><h1>Current Gallery Images</h1><div id="images"><asp:Panel runat="server" ID="pnlContainer"><asp:Repeater runat="server" ID="rptImages" onitemdatabound="rptImages_ItemDataBound" OnItemCommand="rptImages_ItemCommand" EnableViewState="true"><ItemTemplate><div class="item"><div class="move"><asp:LinkButton runat="server" ID="lbMoveLeft" ToolTip="Move Left" CssClass="left" /></div><div class="center"><asp:Image runat="server" ID="imgThumb" CssClass="thumb" /><br /><asp:LinkButton runat="server" ID="lbRemove" ToolTip="Remove" CssClass="remove" /></div><div class="move"><asp:LinkButton runat="server" ID="lbMoveRight" ToolTip="Move right" CssClass="right" /></div><div class="clear"><!-- --></div></div></ItemTemplate></asp:Repeater><div class="clear"><!-- --></div></asp:Panel></div><br /><h1>New Gallery Image</h1><asp:FileUpload runat="server" ID="fuImage" /><br />
    Title: <asp:TextBox runat="server" ID="txtTitle" /><br /><asp:Button runat="server" ID="btnSave" Text="Save" onclick="btnSave_Click" /><br /><asp:Label runat="server" ID="lblMessage" CssClass="message" /></div>

Here is the cs for the ImageGalleryEditor user control:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
using System.Drawing;
using System.Drawing.Drawing2D;
using System.Drawing.Imaging;
using AjaxControlToolkit;

public partial class controls_ImageGalleryEditor : BaseControl
{
    protected int ViewedUserID
    {
        get
        {
            return String.IsNullOrWhiteSpace(Request.QueryString["uid"])
                ? 0
                : Convert.ToInt32(Request.QueryString["uid"]);
        }
    }

    protected DBUser ViewedUser = null;

    protected override void OnInit(EventArgs e)
    {
        base.OnInit(e);

        if (ViewedUserID < 1)
        {
            Response.Redirect(ResolveUrl("~/Home.aspx"));
        }

        ViewedUser = DBUser.GetUserByID(ViewedUserID);

        return;
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        lblMessage.Text = String.Empty;
        lblMessage.Visible = false;

        pnlContainer.Attributes.Add("style", String.Format("width:{0}px;", ViewedUser.Images.Count * 75 * 2));

        rptImages.DataSource = ViewedUser.Images;
        rptImages.DataBind();

        return;
    }

    protected void rptImages_ItemDataBound(object sender, RepeaterItemEventArgs e)
    {
        RepeaterItem item = e.Item;
        if (item.ItemType == ListItemType.Item || item.ItemType == ListItemType.AlternatingItem)
        {
            DBImage image = item.DataItem as DBImage;
            System.Web.UI.WebControls.Image imgThumb = item.FindControl("imgThumb") as System.Web.UI.WebControls.Image;
            LinkButton lbMoveLeft = item.FindControl("lbMoveLeft") as LinkButton;
            LinkButton lbMoveRight = item.FindControl("lbMoveRight") as LinkButton;
            LinkButton lbRemove = item.FindControl("lbRemove") as LinkButton;

            imgThumb.ImageUrl = ResolveUrl(String.Format("~/users/{0}/gallery/thumb/{1}", ViewedUser.ID, image.Filename));
            imgThumb.AlternateText = image.Title;
            imgThumb.ToolTip = image.Title;

            if (item.ItemIndex == 0)
            {
                lbMoveLeft.Visible = false;
            }
            else
            {
                lbMoveLeft.Visible = true;
                lbMoveLeft.CommandName = "left";
                lbMoveLeft.CommandArgument = image.ID.ToString();
            }

            if (item.ItemIndex == (TheUser.Images.Count - 1))
            {
                lbMoveRight.Visible = false;
            }
            else
            {
                lbMoveRight.Visible = true;
                lbMoveRight.CommandName = "right";
                lbMoveRight.CommandArgument = image.ID.ToString();
            }

            lbRemove.CommandName = "remove";
            lbRemove.CommandArgument = image.ID.ToString();
        }

        return;
    }

    protected void rptImages_ItemCommand(object source, RepeaterCommandEventArgs e)
    {
        string command = e.CommandName.ToLower();
        int imageID = Convert.ToInt32(e.CommandArgument);

        switch (command)
        {
            case "left":
                {
                    ViewedUser.DecreaseImageDisplayOrder(imageID);

                    break;
                }
            case "right":
                {
                    ViewedUser.IncreaseImageDisplayOrder(imageID);

                    break;
                }
            case "remove":
                {
                    DBImage image = DBImage.GetImageByID(imageID);
                    string virtualThumb = String.Format("~/users/{0}/gallery/thumb/{1}", ViewedUser.ID, image.Filename);
                    string virtualFull = String.Format("~/users/{0}/gallery/full/{1}", ViewedUser.ID, image.Filename);
                    string physicalThumb = Server.MapPath(virtualThumb);
                    string physicalFull = Server.MapPath(virtualFull);
                    File.Delete(physicalThumb);
                    File.Delete(physicalFull);

                    ViewedUser.RemoveImage(imageID);
                    
                    break;
                }
        }

        pnlContainer.Attributes.Add("style", String.Format("width:{0}px;", ViewedUser.Images.Count * 75 * 1.9));
        rptImages.DataSource = ViewedUser.Images;
        rptImages.DataBind();

        return;
    }

    protected void btnSave_Click(object sender, EventArgs e)
    {
        string title = txtTitle.Text.Trim();
        if (String.IsNullOrWhiteSpace(title))
        {
            lblMessage.Text = "Gallery image title required";
            lblMessage.Visible = true;
            return;
        }

        if (!fuImage.HasFile)
        {
            lblMessage.Text = "no file provided";
            lblMessage.Visible = true;
            return;
        }

        string filename = fuImage.PostedFile.FileName;
        if ((Path.GetExtension(filename) != ".jpeg") &&
            (Path.GetExtension(filename) != ".jpg"))
        {
            lblMessage.Text = "image must be a JPG/JPEG";
            lblMessage.Visible = true;
            return;
        }

        if (fuImage.PostedFile.ContentLength > 1048576)
        {
            lblMessage.Text = "max file size is 1MB";
            lblMessage.Visible = true;
            return;
        }

        Bitmap full = new Bitmap(fuImage.PostedFile.InputStream);
        if ((full.Width > 800) || (full.Height > 600))
        {
            lblMessage.Text = "image must be at most 800 pixels wide and 600 pixels high";
            lblMessage.Visible = true;
            return;
        }
        else if ((full.Width < 150) || (full.Height < 200))
        {
            lblMessage.Text = "image must be at last 150 pixels wide and 200 pixels high";
            lblMessage.Visible = true;
            return;
        }

        string fullVirtualFilename = String.Format("~/users/{0}/gallery/full/{1}", ViewedUser.ID, filename);
        string fullPhysicalFilename = Server.MapPath(fullVirtualFilename);
        if(File.Exists(fullPhysicalFilename))
        {
            lblMessage.Text = "the image filename already exists";
            lblMessage.Visible = true;
            return;
        }

        string thumbVirtualFilename = String.Format("~/users/{0}/gallery/thumb/{1}", ViewedUser.ID, filename);
        string thumbPhysicalFilename = Server.MapPath(thumbVirtualFilename);
        Bitmap thumb = new Bitmap(95, 67);
        Graphics thumbGraphics = Graphics.FromImage(thumb);
        thumbGraphics.Clear(Color.Transparent);
        thumbGraphics.SmoothingMode = SmoothingMode.AntiAlias;
        thumbGraphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
        int thumbWidth = 0;
        int thumbHeight = 0;
        int left = 0;
        int top = 0;
        if (full.Width == full.Height)
        {
            thumbWidth = 67;
            thumbHeight = 67;
            left = (95 - 67) / 2;
        }
        else if (full.Width < full.Height) // portait
        {
            thumbWidth = 67 * full.Width / full.Height;
            thumbHeight = 67;
            left = (95 - thumbWidth) / 2;
        }
        else // landscape
        {
            thumbWidth = 95;
            thumbHeight = full.Height * 95 / full.Width;
            top = (67 - thumbHeight) / 2;
        }
        try
        {
            thumbGraphics.DrawImage(full, left, top, thumbWidth, thumbHeight);
            fuImage.SaveAs(fullPhysicalFilename);
            thumb.Save(thumbPhysicalFilename, ImageFormat.Png);
            DBImage.Add(ViewedUser.ID, filename, title);
        }
        catch (Exception ignored)
        {
            if (File.Exists(fullPhysicalFilename))
            {
                File.Delete(fullPhysicalFilename);
            }

            if (File.Exists(thumbPhysicalFilename))
            {
                File.Delete(thumbPhysicalFilename);
            }

            lblMessage.Text = "upload error - please try again";
            lblMessage.Visible = true;
            return;
        }

        txtTitle.Text = String.Empty;
        pnlContainer.Attributes.Add("style", String.Format("width:{0}px;", ViewedUser.Images.Count * 75 * 1.9));
        rptImages.DataSource = ViewedUser.Images;
        rptImages.DataBind();

        return;
    }
}



Can someone help me out?

Thanks in advance!

Orion

AJAX update panal help

$
0
0

i have a update panal with a content template, inside a content template i have a button, how to make a button without working on ajax function?

ASP .NET AJAX Control Toolkit Error in Internet Explorer 11

CalendarExtender not working

$
0
0

hi

i'm using CalendarExtender but calendar is not shown at all when i click on textbox or image button, so i must be doing something wrong and can't figure it out.

i'm using VS2008, framework 3.5.

this is my code:

<%@ Page Title="" Language="VB" MasterPageFile="~/PlanMaster.master" AutoEventWireup="false" CodeFile="PlanTrip.aspx.vb" Inherits="PlanTrip" %>

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

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
    <style type="text/css">
        .divRectangle
            {
                width:572px;
                height:590px;
                border: solid 1px #6B696B;
                padding-left:5px;
                padding-top:5px;
                padding-bottom:5px;
                position:relative;
                /*position:absolute;*/
                margin: auto;
                top: 0; left: 0; bottom: 0; right: 0;
            }
            
        .pnl
        {
            width:580px;
            height:604px;
            background-color:#F7F7DE;
        }

.divBlank20
{
    height:20px;
}

.lbl
{
    width:150px;
}

.txt
{
    width:140px;
}
    </style>
</asp:Content>

<asp:Content ID="Content2" ContentPlaceHolderID="Main" Runat="Server">
    <asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering ="true">
    </asp:ScriptManager>
    <div class="divHeading">
        <h2>
            <asp:Label ID="lblHeading" runat="server" Text="Plan trip"></asp:Label>
        </h2>
    </div>
    <div class="divBlank20"></div>
    
    <%--<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
        <ContentTemplate>--%>
            <div>
                <asp:Label ID="lblError" runat="server" Text=""></asp:Label>
            </div>
            <asp:Panel ID="pnlNew" runat="server" CssClass="pnl">
            <div class="divRectangle">
                <div>
                    <asp:Label CssClass="lbl" ID="Label7" runat="server" Text="Date from:"></asp:Label>
                    <asp:TextBox CssClass="txt" ID="txtDateFrom" runat="server"></asp:TextBox>
                    <cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDateFrom" ></cc1:CalendarExtender>
                    <%--<asp:ImageButton ID="btn" runat="server" ImageUrl="images/Calendar_scheduleHS.png" />--%>
                    <%--<cc1:CalendarExtender ID="CalendarExtender1" runat="server" TargetControlID="txtDateFrom" PopupButtonID="btn"></cc1:CalendarExtender>--%>
                </div>

                <div class="divBlank20"></div>
                <div style="float:left; width:100px;">
                    <asp:Button ID="btnCancel" runat="server" Text="Cancel" />
                </div>
                <div style="float:left; width:460px; text-align:right;">
                    <asp:Button ID="btnSave" runat="server" Text="Save" />
                </div>
            </div>
            <div class="clear"></div>
            </asp:Panel>
            <div class="divBlank20"></div>
       <%-- </ContentTemplate>
    </asp:UpdatePanel>--%>
</asp:Content>

i have to say that i can't use popupmodal extender (doesn't popup) as well ...

thanks for help in advance

Display Confirm Box when tab changes in tab container

$
0
0

I have taken one tab container and i had craeted 5 tabs. when i have to move from one tab to another i want one confirm box.if use selectsOK goes to the next Tab other wise stay on same tab.Please help me.

gridview column resizing ...

$
0
0

Hi

masters

I am using Jquery for resizing gridview column..but unable to do it.

plz see code and suggest what is problem..

here is full code

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="loginrpt.aspx.cs" Inherits="loginrpt" %><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head></head><meta http-equiv="Content-Language" content="en-us" /><meta http-equiv="Content-Type" content="text/html; charset=windows-1252" /><title></title><link href="../inc/main.css" rel="stylesheet" type="text/css" /><script src="../inc/jquery.js" type="text/javascript"></script><script src="../inc/colResizable-1.3.min.js" type="text/javascript"></script><script type="text/javascript" language="javascript"></script><script type="text/javascript">

            function doPrint()
             {
            var prtContent = document.getElementById('<%= GridView1.ClientID %>');
            prtContent.border = 4;
            var WinPrint = window.open('', '', 'left=100,top=100,width=1000,height=1000,toolbar=0,scrollbars=1,status=0,resizable=1');
            WinPrint.document.write(prtContent.outerHTML);
            WinPrint.document.close();
            WinPrint.focus();
            WinPrint.print();
            WinPrint.close();
            }</script><script type="text/javascript">
      $(function () {
             $('#<%=GridView1.ClientID %>').colResizable({
                liveDrag: true,
                gripInnerHtml: "<div class='grip'></div>",
                draggingClass: "dragging",
            });
        });</script><style type="text/css">
        .style1
        {
            font-weight: bold;
        }</style><body topmargin="0"><form id=f1  runat="server"><div align="center"><table border="0" cellpadding="0" style="border-collapse: collapse" width="100%"><tr><td height="38" class="style1" align="left"><font size="4" color="#5ED548"  ></font></td></tr><tr><td><div align="left"><table border="1" cellpadding="0" style="border-collapse: collapse" width="537" bgcolor="#CCFFCC" height="37"><tr><td><div align="center"><table border="0" cellpadding="0" style="border-collapse: collapse" width="100%"><tr><td width="102">&nbsp;Select Option</td><td><asp:DropDownList ID="DropDownList1" runat="server" Height="16px" Width="228px" AutoPostBack="true"><asp:ListItem Text="---Please Select---" Value="0" /><asp:ListItem Text="Not logged n For Last 5 Days" Value="1" /><asp:ListItem Text="Not logged In For Last 10 Days" Value="2" /></asp:DropDownList></td><td width="30"><asp:Button ID="Button1" runat="server" Text="GO" Width="52px" OnClick="Button1_Click" /></td><td width="30"><asp:Button ID="Button2" runat="server" Text="Print" OnClientClick=" doPrint()"
                        Width="39px" /></td></tr></table></div></td></tr></table></div></td></tr><tr><td>&nbsp;</td></tr><tr><td style="border-style: solid; border-width: 1px; margin-left: 10; margin-right: 10"><div align= "left" style=" height: 500px; overflow:scroll" ><asp:GridView ID="GridView1" runat="server" BorderStyle="None"
                            BorderWidth="1px" CellPadding="4" AutoGenerateColumns="False"
                            style="font-family: Arial; font-size: small" ><Columns><asp:BoundField DataField="user_name" HeaderText="UserName" SortExpression="user_name"  ItemStyle-Height="5px"  ItemStyle-Width="10px" HeaderStyle-Height="10px" HeaderStyle-Width="10px"   ><ItemStyle CssClass="center"/><HeaderStyle Height="10px" Width="10px" ></HeaderStyle><ItemStyle Height="5px" Width="5px"></ItemStyle></asp:BoundField><asp:BoundField DataField="user_designation" HeaderText="Designation" SortExpression="user_designation"  ItemStyle-Height="5px" ItemStyle-Width="10px" HeaderStyle-Height="10px" HeaderStyle-Width="10px" ><ItemStyle CssClass="center" /><HeaderStyle Height="10px" Width="10px"></HeaderStyle><ItemStyle Height="5px" Width="10px"></ItemStyle></asp:BoundField><asp:BoundField DataField="office_name" HeaderText="OfficeName" SortExpression="office_name"   ItemStyle-Height="10px" ItemStyle-Width="5px" HeaderStyle-Height="10px" HeaderStyle-Width="10px"   ><ItemStyle CssClass="center" /><HeaderStyle Height="10px" Width="10px"></HeaderStyle><ItemStyle Height="10px" Width="5px"></ItemStyle></asp:BoundField><asp:BoundField DataField="Ledit" HeaderText="Logintime" SortExpression="Ledit"  ItemStyle-Height="10px"  ItemStyle-Width="10px" HeaderStyle-Height="5px" HeaderStyle-Width="10px" ><ItemStyle CssClass="center"/><HeaderStyle Height="5px" Width="5px"></HeaderStyle><ItemStyle Height="10px" Width="10px"></ItemStyle></asp:BoundField></Columns><RowStyle height="2px" Wrap="False"  /></asp:GridView></div></td></tr><tr><td>&nbsp;</td></tr></table></div></form></body></html>



Ajaxtoolkit AutoCompleteExtender is placing » (right angle quotes) on web form

$
0
0

I'm using the AutoCompleteExtender and I'm getting unwanted arrows >> to the left of my list items.  I'm not getting this result in FireFox.  My code is working great and with this one exception everything is great.  Have a look at the result in IE9 in the picture.

Right arrows being caused by AutoComplete

Your help would be greatly appreciated.  Thanks in advance.

HtmlEditorExtender and TextChanged event

$
0
0

Hello,

I have discovered taht the TextChanged event of the TextBox that has an AJAX HtmlEditorExtender extension attached does not occur.

How can I check when the text into the HtmlEditor is changed?

I need some server side event, in order to save the text into e session variable when the control lost the focus.

This is my actual code that doesn't work.

<asp:TextBox runat="server" ID="txtDescrizione" AutoPostBack="True" TextMode="MultiLine" Width="450px" Height="250px" Rows="5" /><br /><cc1:HtmlEditorExtender ID="htmleeDescrizione"
        TargetControlID="txtDescrizione"
        runat="server"
        DisplaySourceTab="True"
        OnImageUploadComplete="ajaxFileUpload_OnUploadComplete"
        Enabled="True"><Toolbar><cc1:Bold /><cc1:Italic /><cc1:Underline /><cc1:HorizontalSeparator /><cc1:JustifyLeft /><cc1:JustifyCenter /><cc1:JustifyRight /><cc1:JustifyFull /><cc1:CreateLink /><cc1:UnLink /><cc1:InsertImage /></Toolbar></cc1:HtmlEditorExtender>

code behind

if (!Page.IsPostBack)
{
	txtDescrizione.TextChanged += new EventHandler(txtDescrizione_LostFocus);
	//
	if (Session["txtDescrizione_temp"] != null)
	{
		txtDescrizione.Text = Convert.ToString(Session["txtDescrizione_temp"]);
	}
}

private void txtDescrizione_LostFocus(object sender, System.EventArgs e)
{
	Session["txtDescrizione_temp"] = System.Web.HttpUtility.HtmlDecode(txtDescrizione.Text);
}



 

Why is there a confirm form resubmission error caused when combineScripts of ToolkitScriptManager is set to false.

$
0
0
I am wondering why when I hit the button twice on the page below and then hit the browser back button there is an error, but when I change combinescripts="true" it doesn't cause an error.
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %><%@ Register TagPrefix="ajaxToolkit" Namespace="AjaxControlToolkit" Assembly="AjaxControlToolkit" %><!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head runat="server"><title></title></head><body><form id="form1" runat="server"><ajaxToolkit:ToolkitScriptManager ID="ToolkitScriptManager1" runat="server" ScriptMode="Release" CombineScripts="false"></ajaxToolkit:ToolkitScriptManager><div><asp:Button ID="Button2" runat="server" Text="Button" /></div></form></body></html>

Unable to get the validation working

HTMLEditorExtender - Cannot see the toolbar

$
0
0

Hi,

I recently installed VS Express 2013 for web. I opened a webforms project and installed AJAXControl tool kit.  I went through some msdn/blog pages to implement  a Rich Text editor.

<asp:TextBox ID="txtComments"TextMode="MultiLine"Columns="120"Rows="16"runat="server"/>

<ajaxToolkit:HtmlEditorExtenderID="htmlEditorExtender1"TargetControlID="txtComments"DisplaySourceTab="true"runat="server">

<Toolbar><ajaxToolkit:Undo/><ajaxToolkit:Redo/><ajaxToolkit:Bold/><ajaxToolkit:Italic/><ajaxToolkit:Underline/></Toolbar>

</ajaxToolkit:HtmlEditorExtender>

Also, i have this section in my master page under form tag.

        <ajaxToolkit:ToolkitScriptManager runat="server">   
            <Scripts>
                 <asp:ScriptReference Name="MsAjaxBundle" />
                <asp:ScriptReference Name="jquery" />
                <asp:ScriptReference Name="bootstrap" />

</Scripts>

</ajaxToolkit:ToolkitScriptManager>

 When i run the solution,

In firefox browser, i can see the text box, but with out the toolbar.

In IE, it thorws the below error in ScriptResource.axd -

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 AjaxScriptManager in System.Web.Ajax.dll, or use the ToolkitScriptManager in AjaxControlToolkit.dll.

I tried several options, but nothing worked.

1. Referring the AJAX control tool kit 4.0 dll.

2. Changing the target framwework from 4.5 to 4.0 did not work.

3. Changing the script references (Somebody suggested Removing MSAjax, and deleting the attribute [Assemlby = "System.Web"] in the <script reference> tag.  

Any help will be greatly appreciated.

Thanks

Jawahar

 

Viewing all 5678 articles
Browse latest View live


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