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

Good technique for a ajax for asp dot net?

$
0
0

Hi currently we are using Telerik contols for our web site application. i want to replace telerik rad ajax manager by normal update panel.

What are the best way to achive ajax in ASP dot net?  is there any other way to do the same with update panel? 


asynchronous postback interfering with button click events

$
0
0

Sys.WebForms.PageRequestManager.getInstance().add_beginRequest is causing a button click event not to fire.

protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                string enableOnTimeoutScript ="<script type='text/javascript'>Sys.WebForms.PageRequestManager.getInstance().add_beginRequest(" +"function (sender, args) { if (args.get_error()) { ";

                int buttonIndex = 0;

                foreach (Button button in allButtons)
                {
                    enableOnTimeoutScript +=
                        string.Format("var button{0} = document.getElementById('{1}'); " +"if (button{0} != null) button{0}.disabled = true; ", buttonIndex++, button.ClientID);
                }

                enableOnTimeoutScript +=
                    string.Format("var validator0 = document.getElementById('{0}'); " +"if (validator0 != null) {{ validator0.style.visibility = 'visible'; " +"validator0.innerHTML = args.get_error().message; }} ", customValidator.ClientID);

                enableOnTimeoutScript += "args.set_errorHandled(true); } });</script>";

                Literal enableOnTimeoutLiteral = new Literal();
                enableOnTimeoutLiteral.Text = enableOnTimeoutScript;

                panelDocumentNav.Controls.Add(enableOnTimeoutLiteral);
            }
                
            Button saveData = new Button();
            saveData.EnableViewState = true;
            saveData.Click += new EventHandler(dynamicButton_Click);
            saveData.Text = "SAVE";
      }

 <asp:Content ID="contentBody" ContentPlaceHolderID="contentPlaceHolderBody" runat="server"><div style="height: 100%; left: 0px; position: absolute; top: 0px; width: 76%;"></div><asp:Panel ID="panelDocumentNav" runat="server" CssClass="panel" Width="24%" Style="height: 100%;
        position: absolute; right: 0px; top: 0px;"><div class="spacer" style="overflow: auto; height: 100%"><asp:PlaceHolder runat="server" ID="dynamicControls"></asp:PlaceHolder></div><asp:UpdatePanel ID="updatePanelQ" runat="server"><ContentTemplate><div><asp:CustomValidator ID="customValidator" runat="server" CssClass="error" /></div></ContentTemplate></asp:UpdatePanel>


When the page is first loaded and the SAVE button is clicked the dynamicButton_Click event is not fired but a post back occurs b/c the Page_Load method is called but the if (!IsPostBack) is false so code within if statement is not executed.  The page is reloaded.  If I click the button again the dynamicButtonClick event is fired.

If I comment out the code in the if (!IsPostBack) the dynamicButton_Click event is fired on the first click.

Why is the event not being fired on the first click?

AjaxFileUpload doesn't work !!

$
0
0

I just try to use ajaxfileupload but it doesn't work . I don't know what is my wrong . this is what I see when I run my page :

and this is my desing:

HTMLEditorExtender display problem

$
0
0

Hi there!

I have an ASP.NET page that has a textbox on it with an HTMLEditorExtender control and an ADD/UPDATE button that allows my users to enter, read, update and delete HTML formatted text to and from a text field in a SQL Server database table.  I'm using the HTTPUtility.HTMLDecode to control the display of the formatted text within the textbox. 

The data in the text field in the database table is stored with all the appropriate HTML tags intact, as I expect, and when the data is retrieved from the database and loaded into the textbox, the HTTPUtility.HTMLDecode function correctly processes the embedded HTML tags and displays the formatted text correctly.

Well, almost!  I am having a bizarre problem with some text becoming invisible on postback.  What happens is if I enter several lines of text and each of these lines is shorter than the width of the textbox (i.e. none of the lines wraps around), then once I click the ADD/UPDATE button only the first line remains visible.  The other lines are still there on the page (but invisible!) and I can move my cursor over them.  If I position the cursor somewhere on one of these invisible lines and press the backspace key, the lines magically become visible again (minus the character I just erased with the backspace key).  If I click the ADD/UPDATE button again, the lines become invisible again.  Checking the database shows that everything is added and updated correctly (i.e. text for all the lines, visible or not, is in the text field in the database).

This odd behaviour only happens when all the lines of text are shorter than the width of the textbox and there is no wrap around anywhere.  If at least one line of text exceeds the width of the textbox and wraps around, then this problem doesn't occur and everything is fine.

Has anyone else experienced this?  Any ideas as to what might be causing it?  I've spent the last two days scouring the web searching for answers and I'm still scratching my head.

Any help at all would be greatly appreciated!

Note:  I did try removing the HTMLEditorExtender control and just use a plain textbox and the problem does not occur, so I believe the culprit is the HTMLEditorExtender control.

Cheers!  Smile

 

Chris.

Make tabpanel header unclickable

$
0
0

I having an application which allow user to report cases. I have done it using a Tab Container which have 5 Tab Panel in it. The user required to report accordingly to the 5 panel I included. In the Tab Panel I have insert 2 button for the user to go to the next or previous tab. I don't wish to let the user jump to the next tab by clicking on the Tab Panel Header so I want to disable the header from clicking it but with the header there. After doing some research, I realise that it possible to do it using javascript. I don't really understand on how to use javascript to disable the tabpanel header. So do help me out on how to disable tabpanel header other than using of javascript. Thanks!

Validations not firing if image button is having OnClientClick in RadGrid

$
0
0

Hi All,

I am using telerik grid and form settings in it. I have a javascript function lets say WrongValidation() which i'm caling on imagebutton onclientclick event like OnClientClick="return WrongValidation();" and CauseValidation="true". the WrongValidation() function will validate two textboxes and I have dropdowns and some other textboxes with respective required field validators in that form settings in radgrid. when i click on button the other validations are not firing. if i remove the onclientclick then other validations are firing

help me

Thanks in Advance

How to solve Web resource error while combining the scripts using Ajax ToolkitScriptManager?

$
0
0

I have been improving the performance of my website and i came to know the ScriptReferenceProfiler is use to combine the Ajax_toolkit & some web resources,to boost up the performance.

By using ToolkitScriptManager:

<cc1:ToolkitScriptManager runat="server" ID="sm1"><CompositeScript><Scripts><asp:ScriptReference path="/ScriptResource.axd?d=M0u-0gm-xoUth3VZopOlO19uXBqYylHt2jezyL4jPbfiHjNk-JI6jH6BsvqLfCUiT_Dx9J26HOG7PAWz24kG00bCn2s6mIGclwqIqLa3spXRaCRH82DuCtXVC9ygxbFZoVmQdSSkaXoxHoRorffG4w2&t=ffffffffe81e7100"/><asp:ScriptReference path="/ScriptResource.axd?d=Qq0Q47FYHHV5DMGy8k83RC-Hk1Wt8W1VBhLZBjOSciZ-JUyplMa6iyHPUrI8OWM54Pg55HDdjU7VFbadAqD_u86QrvB9Wul_ShbRNRt0PkflgO81vzSybG4mT6H7BQS0HFwQW2jB9JppzlAcvLCwrg2&t=ffffffffe81e7100"/><asp:ScriptReference name="Common.Common.js" assembly="AjaxControlToolkit, Version=3.5.60501.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/><asp:ScriptReference name="ExtenderBase.BaseScripts.js" assembly="AjaxControlToolkit, Version=3.5.60501.0, Culture=neutral, PublicKeyToken=28f01b0e84b6d53e"/>
      ..etc</Scripts></CompositeScript></cc1:ToolkitScriptManager>

by using it in my page it shows "Web resource '/ScriptResource.axd?d=M0u-0gm-(large url) was not found.How can i resolve this issue?

overcomeThe Free Dictionary: To defeat in competition or conflict; conquer.

C# Windows

$
0
0

Hi,

I have a listbox,i get values in it as decimal.i read that values one by one and store the 2nd and 3rd values in a variable and now that variable consists of 8 digit value.

 

I want to convert that value into float using IEEE method and display it in a text box.

Please give me your suggestion to convert it.Thank you in advance.

 

 

 


TabContainer Issues

$
0
0

Hi all,

I am having problems with my tabcontainer due to unfamiliarity with tabs CSS.

I have a tabcontainer with 2 tabpanels but the tab panels buttons become mixed with the tab content.

I tried adjusting the height of the tabpanel but it doesn't really solved my problem.

Example : http://tinypic.com/r/a13ic2/5 (Picture of gridview by the right side)

And i also have a doubt on this when i researched

Tabs Css classes 

  • .ajax__tab_header: A container element that wraps all of the tabs at the top of the TabContainer. Child CSS classes:.ajax__tab_outer.
  • .ajax__tab_outer: An outer element of a tab, often used to set the left-side background image of the tab.Child CSS classes: .ajax__tab_inner.
  • .ajax__tab_inner: An inner element of a tab, often used to set the right-side image of the tab. Child CSS classes:.ajax__tab_tab.
  • .ajax__tab_tab: An element of the tab that contains the text content. Child CSS classes:none.
  • .ajax__tab_body: A container element that wraps the area where a TabPanel is displayed. Child CSS classes: none.
  • .ajax__tab_hover . This is applied to a tab when the mouse is hovering over. Child CSS classes:.ajax__tab_outer.
  • .ajax__tab_active: This is applied to a tab when it is the currently selected tab. Child CSS classes:.ajax__tab_outer.

I don't really know what the description is explaining about for all except the last point.

disabling tabs of tab continer & viewstate error

$
0
0

i have a tab conatiner with 5 tabs each having gridview populated with data
if a control is visible true on page load

on post back ie a button click the tabs are made enabled true/false depending on the record count for the grid
if count is 0 the tab will be disabled (but gets visible=false)

i have javascript also using the tabindex
when i click another button
i get errro

Failed to load viewstate.  The control tree into which viewstate is being loaded must match the control tree that was used to save viewstate during the previous request.  For example, when adding controls dynamically, the controls added during a post-back must match the type and position of the controls added during the initial request.

how do i rectify it
or is there ay way by which the tabs can be made enabled=false not visible= false

Managing scroll position of a Hovermenu extender panel on a Modal Popup Extender

$
0
0

Hi,

Can anyone help me with my problem. I have a GridView that is being displayed on a ModalPopupExtender. The HoverMenuExtender is used to Edit/Delete the items in the gridView. My problem is that when the gridview has more number of rows than the ModalPopup height, the Edit/Delete buttons are not displayed correctly near the highlighted row. The Edit/Delete buttons are displayed randomly at the top.

Please help me.

Thanks in Advance

- Sai

Hide and Display of TabPanel in TabContainer

$
0
0

I'm trying to hide the TabPanel4 when the application start, then when user select specific item from the dropdownlist it then display the TabPanel4 out for the user. Below is the code I used, not sure why it not working. Do help me take a look at my code see which part did I do wrongly. Thanks!

Aspx

<asp:TabContainer ID="TabContainer1" runat="server" Height="75%" Width="100%" UseHorizontalStripPlacement="true"
    ActiveTabIndex="0" OnDemand="true" AutoPostBack="true" TabStripPlacement="Top" ScrollBars="Auto"><asp:TabPanel ID="TabPanel1" runat="server" HeaderText="Incident Information" Enabled="true" ScrollBars="Auto" OnDemandMode="Once"><ContentTemplate><table width="100%"><tr><td><b>Type of crime:</b><asp:DropDownList ID="ddlToC" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlToC_SelectedIndexChanged"><asp:ListItem>Accident</asp:ListItem><asp:ListItem>Theft</asp:ListItem><asp:ListItem>Robbery</asp:ListItem><asp:ListItem>Housebreaking</asp:ListItem><asp:ListItem>Fraud</asp:ListItem><asp:ListItem>Loan Shark</asp:ListItem></asp:DropDownList><br /></td></tr></table></ContentTemplate></asp:TabPanel><asp:TabPanel ID="TabPanel4" runat="server" HeaderText="Property" Enabled="true" ScrollBars="Auto" OnDemandMode="Once" Visible="false"><ContentTemplate>
            Is there any property lost in the incident?<asp:RadioButton ID="rbPropertyYes" runat="server" GroupName="rbGroup3" Text="Yes" AutoPostBack="True" /><asp:RadioButton ID="rbPropertyNo" runat="server" GroupName="rbGroup3" Text="No" AutoPostBack="True" /><br /><br /><asp:Label ID="Label4" runat="server" Text="Describe what was lost in the incident." Visible="False"></asp:Label><br /><br /><asp:TextBox ID="txtProperty" runat="server" Height="75px" TextWrapping="Wrap" TextMode="MultiLine" Width="400px" Visible="False"/><br /><br /><asp:Label ID="Label5" runat="server" Text="You have " Visible="False"></asp:Label><asp:Label ID="lblCount3" runat="server" Text="500" Visible="False"></asp:Label>&nbsp;<asp:Label ID="Label6" runat="server" Text=" characters left." Visible="False"></asp:Label></ContentTemplate></asp:TabPanel></asp:TabContainer>

Code behind

protected void ddlToC_SelectedIndexChanged(object sender, EventArgs e)
{
if (ddlToC.SelectedValue.Equals("Theft"))
{
TabPanel4.Visible = true;
}
else if (ddlToC.SelectedValue.Equals("Robbery"))
{
TabPanel4.Visible = true;
}
else if (ddlToC.SelectedValue.Equals("Housebreaking"))
{
TabPanel4.Visible = true;
}
else if (ddlToC.SelectedValue.Equals("Fraud"))
{
TabPanel4.Visible = true;
}
}

To add on: even I take away the Visible="false" from the aspx page and set it in code behind page under Page_Load it don't work, it still don't appear when I select the item in the dropdownlist. Also tried using 

TabContainer1.Tabs[3].Visible = false / true;
 to hide or display it but it also don't seem to work.

Clear AjaxControlToolkit ComboBox

$
0
0

I have a ComboBox control from AjaxControlToolkit, it works fine. But I can not clear selected item to empty (when page is load, it show nothing, and then I can either click dropdown to pick an item or type in an item) I have button and I want to clear my select after click the button. I tired several ways but neither works.

My ComboBox like this:

<asp:ComboBox ID="ComboBox1" runat="server" AutoCompleteMode="Suggest"
DataSourceID="SqlDataSource1" DataTextField="Name" DataValueField="NameID"
EnableViewState="False" MaxLength="0"
style="display: inline;" Width="86px"></asp:ComboBox>

and DropDwonStyle property is default (DropDown).

I tried:

1. ComboBox1.SelectedIndex = -1

2. ComboBox.SelectedItem.Text = ""

3. ComboBox1.SelectedValue = -1

4. ComboBox.Item.Clear()

Is There a way to clear the selection? Thanks.

Error "type or namespace name 'IContentPlaceHolders' could not be found"

$
0
0

Error is in  Sample\DefaultMaster.master.cs:

The type or namespace name 'IContentPlaceHolders' could not be found (are you missing a using directive or an assembly reference?)

I'm still new (and shaky :) enough to VS 2005, and haven't really done anything with a master page yet, to not be sure what I'm missing here. I had d/l the Toolkit and all the samples, have it showing in my folders in VS, the toolbox, etc etc, but the samples won't build just for this one last error.

I'm ass-u-ing it's a reference of some kind, a using tag, whatever, but sorry, not sure where it would go :(

TIA

elaine
charlottesville, va

Script error when using Ajax File upload control

$
0
0

Script error in page when Ajax asynchronous file upload is used.

Error:

Firefox: A script on this page may be busy, or it may have stopped responding. You can stop the script now, or you can continue to see if the script will complete.

IE: Script has blocked running.

Any help on this..


Login Control and Update panel

$
0
0

hi all

i want know how is it possible use update panel or ajax for login control with out refresh page

Actually i want use login control and user login witout refresh page

if logon is not successful page dont refresh or redirect , and error message show

thank's

control inside updatepanel and outside update panel

$
0
0

can any on clear me!

If i place a control inside updatepanel and want to change the value of a control in outside updatepanel on partial postback, i can't change the value. it remains old. how to manage this update panel issue.. another is, how to call a javascript function before partial postback of a control inside update panel...  clear how to manage this...

Thank you.

TabContainer

$
0
0

Hey guys i have a problem....My TabContainer tabs' text doesn't show properly...

 

Reference : http://tinypic.com/r/j9lcfp/5

I tried changing the height of header and tabs it didn't work 

.ajax__tab_xp .ajax__tab_header
{
    height:21px;
    font-family: Arial, helvetica, sans-serif;
    font-size: 30px;
    color: #3a3a3a;
    display:table;
}

.ajax__tab_xp  .ajax__tab_tab
{
padding: 4px 30px;
width:80px;
}

CascadingDropDown selectedindexChanged got fire even I do not click on it, why?

$
0
0

I have 3 following dropdownlist

<asp:UpdatePanel ID="UpdatePanel_ComponentFromStore" runat="server">
<ContentTemplate>
1: ComponentFamily : store all family of components

<asp:DropDownList ID="ddlComponentFamily" runat="server"
AppendDataBoundItems="True" AutoPostBack="True"
DataSourceID="objDSComponentFamily" DataTextField="ComponentFamilyName"
DataValueField="ComponentFamilyID"
onselectedindexchanged="ddlComponentFamily_SelectedIndexChanged">
<asp:ListItem Value="-1">-- Component Family --</asp:ListItem>
</asp:DropDownList>
<asp:ObjectDataSource ID="objDSComponentFamily" runat="server"
SelectMethod="GetComponentFamily" TypeName="CMMS.DAL.ComponentFamilyFactory">
</asp:ObjectDataSource>

2. Component : store all components items base on ComponentFamily

<asp:DropDownList ID="ddlComponent" runat="server" AutoPostBack="True"
onselectedindexchanged="ddlComponent_SelectedIndexChanged"
ontextchanged="ddlComponent_TextChanged">
</asp:DropDownList>
<ajaxToolkit:CascadingDropDown ID="ccdComponent" runat="server"
Category="Component" Enabled="True" LoadingText="Loading List..."
ParentControlID="ddlComponentFamily" PromptText="--Component--"
ServiceMethod="GetComponentServices"
ServicePath="~/Common/Webservices/ComponentService.asmx"
TargetControlID="ddlComponent" UseContextKey="True">
</ajaxToolkit:CascadingDropDown>

3. ComponentID : store all components items without concerning which Family its belong too

<asp:DropDownList ID="ddlComponentByID" runat="server"
AppendDataBoundItems="True" AutoPostBack="True"
DataSourceID="objDSComponentByID" DataTextField="ComponentID"
DataValueField="ComponentID"
onselectedindexchanged="ddlComponentByID_SelectedIndexChanged">
<asp:ListItem Value="-1">-- Component ID --</asp:ListItem>
</asp:DropDownList>
<asp:ObjectDataSource ID="objDSComponentByID" runat="server"
SelectMethod="GetActiveComponent" TypeName="CMMS.DAL.ComponentFactory">
</asp:ObjectDataSource>
</ContentTemplate>
</asp:UpdatePanel>

I have had 2 senarios need to be perform on user selection.
Senario 1:
User can select an item in ComponentFamily, then an item in Component then an item in ComponentID will also selected base on the same value.

Senario 2:
User can select an item in ComponentID, then the ComponentFamily, and Component Item will automatically selected the related value.


Here is my code to managed the dropdownlist

protected void ddlComponent_SelectedIndexChanged(object sender, EventArgs e)
{
if ((ddlComponentByID.Items.Count > 0) && (ddlComponent.Items.Count > 0) && (ddlComponent.SelectedValue!=string.Empty))
{
ddlComponentByID.SelectedValue = ddlComponent.SelectedValue;

}
}

protected void ddlComponentFamily_SelectedIndexChanged(object sender, EventArgs e)
{
ddlComponentByID.SelectedValue = "-1";
}

protected void ddlComponentByID_SelectedIndexChanged(object sender, EventArgs e)
{
if ((ddlComponentByID.SelectedItem.Value != "-1") || (ddlComponentByID.SelectedItem.Value != string.Empty)){
Component objComponent = (Component)_objCom.GetActiveComponentByID(ddlComponentByID.SelectedItem.Value)[0];
ddlComponentFamily.SelectedValue = objComponent.ComponentFamilyID.ToString();
ccdComponent.SelectedValue = objComponent.ComponentID;
}
}


I have no idea, why the ddlComponent_SelectedIndexChanged is always fire event I just click on ddlComponentByID. It's not
just only that component, but also other events on the components outside the Update Panel.

Could you please guide me how could I solve this problem?

Best regards,

Veasna

AJAX Controls Toolkit Problem

$
0
0

Hello My Name is Ahmad,

It's my First time that i'm trying to work on Ajax for .Net Framework 4.0 i have downloded the toolkit and adding all the controls to tollbox and when i'am trying to use asp.net editor it's looking clear into design but dosen't loaded into browser.

please can anybody help me.

Viewing all 5678 articles
Browse latest View live




Latest Images