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

DataTable in asp.net = DataTables in AJAX

$
0
0

Hi Friends,

 As I am new to AJAX , I want to inquire is it possible how I can convert or change my asp.net datatable  (in asp.net 4.5) into ajax datatable and show as like gridview.

thank you.

regards,

asad


How to Refresh the Master Page from Button Click

$
0
0

Hi friends,

I want to Thank you All :-)

My Doubt is,

How to refresh the master page(that contain many pages within) when a button click happen in the one of the page it has.

Actually When I'm doing login in another page it working but the login information are not updated in the another page.

Please help me

Thank you!

Renuka.V

Newbie Query a database using javascript or ajax

$
0
0

Sorry, im brand new to ASP, ive searched the forums but cant seem to find a definitive answer.

I've a web form with a formview that when the user tabs into each field I want to fill in a paragraph of help text on the right of the screen.  I want the help text for each field to be stored in a database table as there are 4 elements, areaTitle, areaHelpText, fieldTitle and FieldHelp text.  My question is:

Can I add a javascript function that accesses the sql database and brings back the 4 elements to populate them on the screen? (if so any examples)

Or

Would I use the built in ajax controls and put the help fields in a updatePanel, accessesing the sql table in the page on load? If so how do I partial postback the panel on the blur of the field I am displaying the help for in javascript?

OR

Do I write a webservice to bring back the help fields calling it from the field onBlur event? Ive tried this using the XMLHTTP cjavascript classes but cant seem to get it quite right so would appreciate any examples?

Thanks in advance to anybody who replies, as I said this is my first application so would appreciate some guidance on the best way and some examples if anybody has any!

Ajax site not working correctly on Remote machine when run from Server 2008 R2.

$
0
0

I've been working on an Ajax site for a while and recently attempted to publish it to a Window Server 2008 R2 server.

The site works correctly on my Devel machine and when run locally on the windows 2008 R2 server, but when I open the site from another machine the page doesn't operate the same way.  Some functionality is lost.

I've looked at the server logs, and an error originally being displayed on the remote machine indicated a Hotfix from MS was required to fix a known issue with the server changing it's password.  I've tried changing the App Pool to NetworkService, and have even allowed delegation on the Server Object.

Is there something else I could try, or somewhere else I should be looked for an error?

Thanks

Find and refresh update panel in the master page

$
0
0

Hi,

Please help me.

How to find the update panel in the master page, After finding it I need to refresh that panel.

I tried some methods but tat not finds the update panel control.

Best regards,
Renuka.V

Modal Popup closes with Cascading drop-down selection

$
0
0

I have a modal pop up defined on a page that uses a mater page architecture and have cascading dropdowns.

The issue is that on selection of an item in a parent drop down may modal pop up closes due to a post back event of selected index change.

On debugging, I found that the page pre render event is being triggered again.

Please advise to fix this issue and keep the modal popup open with cascading drop down selections.

Ajax weather

$
0
0

Hi,

I'm writing a simple code to show the weather of a US state and a related city but when I click on the button I doesn't work, can anyone help me and show me the right syntax and also the reason that why this happens?

my code is as below:

JQUERY$(document).ready(function () {$('#btn').click(function () {
                var state = $('#ddl_states option:selected').text();
                var city = $('#ddl_cities option:selected').text();

                alert(state + city);$.ajax({
                    url: "http://api.wunderground.com/api/b5579d1a73a33985/conditions/q/" + state + "/" + city + ".json",
                    dataType: "jsonp",
                    success: function (item) {
                        console.log(item);

                        var html = "";
                        html += "<article><p>" + item.current_observation.feelslike_string + "</p>";
                        html += "<img src='" + item.current_observation.icon_url + "' alt='' </img>";
                        html += "</article>";$("#weatherdiv").append(html);
                    }
                });
            });
        });
HTML<body><form id="form1" runat="server"><asp:DropDownList ID="ddl_states" runat="server" DataSourceID="DS1" DataTextField="state" DataValueField="state_id"></asp:DropDownList><asp:SqlDataSource runat="server" ID="DS1" ConnectionString="<%$ ConnectionStrings: statesCS %>"
            SelectCommand="select [state], [state_id] from [states]"></asp:SqlDataSource><asp:DropDownList ID="ddl_cities" runat="server" DataSourceID="DS2" DataTextField="city" DataValueField="city"></asp:DropDownList><asp:SqlDataSource runat="server" ID="DS2" ConnectionString="<%$ ConnectionStrings: statesCS %>"
            SelectCommand="select state, city from cities where state=@state order by city"><SelectParameters><asp:ControlParameter Name="state" ControlID="ddl_states" /></SelectParameters></asp:SqlDataSource><button id="btn">Get weather</button><div id="weatherdiv"></div></form></body>

Thanks in advance :)

 

[Ajax.AjaxMethod()] Not working in Visual studio 2013

$
0
0

Hi,

I am Upgrading my project from VS2010 to VS2013.

I am calling Ajax methods from Javascript. By using [Ajax.AjaxMethod()] in .cs page.

In 2010 its working fine.

But in 2013 its giving errors as below 

Failed to load resource: the server responded with a status of 404           ajax/common.ashx not found.

But in our Application ajax folder it self not there.

In Web.config we added below code

<location path="Ajax" inheritInChildApplications="false"><system.web><httpHandlers><remove verb="*" path="*.asmx" /><add verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" /></httpHandlers></system.web><system.webServer><handlers><remove name="Ajax" /><add name="Ajax" verb="POST,GET" path="ajax/*.ashx" type="Ajax.PageHandlerFactory, Ajax" /></handlers></system.webServer></location>

Even though I am getting same error. 

Then i tried to replace the dll's with latest .net 4.5 ajaxtoolkit Dll's, Tried installing AjaxToolkit via Nuget... Still no luck.

All Ajax methods are not working.

Please help me.

Thanks,

Shivanag.


update or refresh the usercontrols

$
0
0

Hi,

Pleas help me.

How to update or refresh the usercontrols  in Asp.Net(C#)

best regards,

Renuka.V

ajax autocomplete populated

$
0
0

I have an autocomplete ajax script (see below) how do I populate the list from a recordset?

 <script>
        $(function() {
        var availableTags = [
        "435451", "430002", "3430003", "6760004", "73405","56766"  <-- must populate this list dynamically  from  database  there are 900 rows and added each day bThis list cannot be static it must be dynamic only.
 ];
        $( "#itemID" ).autocomplete({
        source: availableTags
        });
        });
 </script>

ModalPopup Bigger than Containing Iframe?

$
0
0

I have a widget some customers are using in a small iframe on their websites.  Visitors can click on a button in the widget, and a modal popup appears.  However, no matter how big the popup is, only part of it is visible because the iframe is smaller than the popup.

The iframe resides on the customer's website, and the widget is an ASPX page on my website.

Is it possible for my modal popup fired from within an iframe to be model to the page containing the iframe and hence be bigger than the iframe?

ScriptResource blocked on HTTPS connection

$
0
0

Hi All: I have a child web page with some Ajax toolkit items that works fine over HTTP, but if I request the page over HTTPS the controls don't run, and I see errors like:

Mixed Content: The page at '[link removed]' was loaded over HTTPS, but requested an insecure script '[link removed]/ScriptResource.axd?d=VuXb93bWLgYY3nuh5X…xWzda9WNoHhwFx-FmEsF8ZVDwwNdwxwqUe20_beJwv3LV7bmUeF6F9XZ5qg-1g0&t=23c9c237'. This request has been blocked; the content must be served over HTTPS.

At the beginning of my content section of the child page I have:

<ajaxToolkit:ToolkitScriptManager runat="server" ID="sm1" EnablePageMethods="true"></ajaxToolkit:ToolkitScriptManager>

How can I "force" the scripts to be called over HTTPS?

ASP.NET Page size

$
0
0

I have a page with two gridviews to template item using HTML tables,  that refresh each 20 seconds that loads a realtime data from csv stream , when page is loaded the size is 30KB and it runs 24/7 , the admins reported that 30KB is consuming a lot of bandwidth over month and  the size should be optimized , I did all what I know to reduce white spaces, minimal use of control as I'm rendering data directly in cells,

<img src='<%# GetStationStatus(Convert.ToString(Eval("Date")), Convert.ToString(Eval("Time"))) %>' /><font class="RTUnit2"> <%# Eval("Time") %> </font></td><td style="background-color:azure;width:150px;text-align:right"><%# DataBinder.Eval(Container.DataItem, "Station") %></td>

I'm using following method to reload the page, the concern I have is to reduce  the size

 

$(document).ready(function pageCounter() {
    counter = 20;
    setInterval(function () {
        counter--;
        if (counter >= 0) {
            span = document.getElementById("counter");
            span.innerHTML = counter;
        }
        // Display 'counter' wherever you want to display it.
        if (counter === 0) {$("[id*=Button1]").click(); counter = 20;
        }
    }, 1000);
});


 what do I need to make the size of my page smaller

 

if any other information are needed please inform me

 

BR

Can I set ToolkitScriptManager ScriptMode value dynamically (ScriptManager or ToolkitScriptManager)

$
0
0

I don't want to have to set this value manually as I always forget when publishing to production.

I want them to change like values in web.config when a config is built that contains xdt:Transform.

MSDN says this for the Auto setting for ScriptManager

Debug versions of client script libraries are used in the Web page when the retail attribute of the deployment configuration element is set to false. Otherwise, the release versions of client script libraries are used.

When I follow the 'deployment' link it gets error: This Topic Is No Longer Available

I have also read other places that ScriptManager should be used instead of ToolkitScriptManager. I don't know what to do anymore. I think Im taking a step forward, then I've taken 2 backwards.

In looking for info on this I read about combining scripts to improve performance, but the pages i read were far from clear and complete.

Can anyone tell me or direct me to a page that has good and detailed information on this.

Thanks

UpdateProgress control hangs

$
0
0

I have a web form page the contains an update panel, a timer control and an UpdateProgress control.   The timer control contains functions that update several grids, while the UpdateProgress control displays a message telling the user that the page is being updated.  The page runs fine for hours and then all of a sudden the UpdateProgress control message just hangs.  You have to refresh the page at which time the page acts as expected until the next time it hangs.  The timer control c# code includes error processing, which should log any errors to the database, but I get no error messages.  At this point I'm lost and wonder if anyone has any suggestion where to look for an answer to what may be causing this problem.

Thanks


Modal windows to populate DropDownList and then Refresh without PostBack

$
0
0

Hi, I would like to do the following, can someplease point me in the right direction?

-with HyperLink popup a modal window

-edit database entries for a DropDownList to use

-on close of modal window without PostBack so form entries are not lost refresh the DropDownList showing the new edited entries

Thank you,

Can some please help?

Dynamically Expandable List Items

$
0
0

Hello,

I am very new in ASP.NET C#. My requirement is that I need to create a page with dynamically expandable list item as follows:

Main Parent

Main Parent Description

<div id="MainContent_MainServiceList_UpdatePanel1_1"> <div id="MainContent_MainServiceList_pHeader_1" class="cpHeader"></div> </div> <div id="MainContent_MainServiceList_UpdatePanel1_2"> <div id="MainContent_MainServiceList_pHeader_2" class="cpHeader">

The bullets would be Expandable with right hand arrow style. When the bullet of Product1 would be clicked, the bullet style would change to down arrow style and the Product 1 description would be shown along with all its child items(if any). Same would happen for other bullets as well. So something like this:

Main Parent

Main Parent Description

          Product 1 Description</div> <div class="cpHeader"> <div id="MainContent_MainServiceList_UpdatePanel1_1"> <div id="MainContent_MainServiceList_pHeader_1" class="cpHeader">
    • Product 1 Child 1
    • Product 1 Child 2 etc.          
  • Product2
</div> </div> <div id="MainContent_MainServiceList_UpdatePanel1_2"> <div id="MainContent_MainServiceList_pHeader_2" class="cpHeader">

Again if Product 1 Child 1 is clicked, the children of it would be shown in the same manner and so on.  I am not able to show the changing style of the arrows here, but I hope you would understand from the description as above. I  have managed to create the layer upto expanding the Product 1, product 2 etc to show the corresponding child using the Ajax Toolkit and ASP:UpdatePanel but I need something that would enable me to create the same thing again and again until we have reached the last level and now I am stuck as I dont know how to do that. I have put my code as follows:

</div> </div> </div> </div>

ASPX Page Code:<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="DocLeaf._Default" %><%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="AjaxControlToolkit" %><asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server"><div style="float: left; margin-top: 10px; vertical-align: bottom;"><h1><asp:Label ID="MainSevice" runat="server"></asp:Label></h1><asp:Label ID="MainServiceDesc" runat="server"></asp:Label><asp:Repeater ID="MainServiceList" runat="server"><ItemTemplate><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:Panel ID="pHeader" runat="server" CssClass="cpHeader"><ul style="list-style-image: url('/Images/rh.gif')"><li><a href="<%# Eval("pf_id","Default.aspx?pf_id={0}") %>" target="_blank"><%# Eval("HEADER") %></a></li></ul></asp:Panel><asp:Panel ID="pBody" runat="server" CssClass="cpBody"><%# Eval("DESCRIPTION") %><%# GetServiceDetails(Convert.ToInt32(Eval("pf_id"))) %></asp:Panel><AjaxControlToolkit:CollapsiblePanelExtender ID="CollapsiblePanelExtender1" runat="server"
                            TargetControlID="pBody" CollapseControlID="pHeader" ExpandControlID="pHeader"
                            Collapsed="true" CollapsedSize="0"></AjaxControlToolkit:CollapsiblePanelExtender></ContentTemplate></asp:UpdatePanel></ItemTemplate></asp:Repeater><br /><asp:Button ID="Create" runat="server" Text="Create New Service" Style="margin-left: 121px;" PostBackUrl="~/AddNewService.aspx" /></div></asp:Content>


C# Code-Behind Code:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.IO;
using System.Text;

namespace DocLeaf
{
    public partial class _Default : Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            int pf_id = Int32.Parse(string.IsNullOrEmpty(Request.QueryString["pf_id"]) ?"0" : Request.QueryString["pf_id"]);
            GetService(pf_id);
        }

        //get the list of services for the main page        
        public void GetService(int pf_id_param)
        {
            DatabaseInteractor dbInteractor = new DatabaseInteractor();
            String selectstmt = "SELECT * FROM (SELECT 1 hierarchy,m.parent_pf_id,m.child_no,s.* " +"FROM test_cr_map m,test_cr s " +"WHERE m.pf_id = s.pf_id AND m.parent_pf_id =" + pf_id_param + " " +"UNION " +"SELECT 0,NULL,NULL,test_cr.* " +"FROM test_cr " +"WHERE pf_id = " + pf_id_param + ") " +"ORDER BY hierarchy,child_no";


            DataSet result = new DataSet();
            result = dbInteractor.GetDataSet(selectstmt);

            DataTable myDataTable = result.Tables[0];
            for (int i = 0; i < myDataTable.Rows.Count; i++)
            {
                String link = myDataTable.Rows[i]["hierarchy"].ToString();

                if (Convert.ToInt32(myDataTable.Rows[i]["pf_id"]) == pf_id_param)
                {
                    MainSevice.Text = myDataTable.Rows[i]["HEADER"].ToString();
                    MainServiceDesc.Text = myDataTable.Rows[i]["DESCRIPTION"].ToString();
                    myDataTable.Rows[i].Delete();
                }
            }
            //BulletedServiceList.DataSource = myDataTable;
            //ServiceBulletedList.DataBind();
            //BulletedServiceList.DataTextField = "header";
            //BulletedServiceList.DataValueField = "link";
            //BulletedServiceList.DataBind();

            MainServiceList.DataSource = myDataTable;
            MainServiceList.DataBind();
        }

        //get the list of detailed services        
        public String GetServiceDetails(int pf_id)
        {
            DatabaseInteractor dbInteractor = new DatabaseInteractor();
            String selectstmt = "SELECT * FROM (SELECT m.parent_pf_id,m.child_no,s.* " +"FROM test_cr_map m,test_cr s " +"WHERE m.pf_id = s.pf_id AND m.parent_pf_id =" + pf_id + ") " +"ORDER BY child_no";
            DataSet result = new DataSet();
            result = dbInteractor.GetDataSet(selectstmt);

            DataTable myDataTable = result.Tables[0];

            //BulletedServiceList.DataSource = myDataTable;
            //ServiceBulletedList.DataBind();
            //BulletedServiceList.DataTextField = "header";
            //BulletedServiceList.DataValueField = "link";
            //BulletedServiceList.DataBind();
            Repeater Repeater1 = new Repeater();
            Repeater1.DataSource = myDataTable;
            Repeater1.DataBind();

            //StringWriter stringWriter = new StringWriter();
            //HtmlTextWriter writer = new HtmlTextWriter(stringWriter);
            foreach (RepeaterItem repeatItem in Repeater1.Items)
            {
                // Add ItemTemplate DataItems Dynamically
                RepeaterItem repeaterItem = new RepeaterItem(repeatItem.ItemIndex, ListItemType.Item);
                Label lbl = new Label();
                //lbl.Text = string.Format("{0} {1} <br />", myDataTable.Rows[repeatItem.ItemIndex]["pf_id"], myDataTable.Rows[repeatItem.ItemIndex]["HEADER"]);
                //lbl.Text = string.Format("{0} {1} <br />","test","test");
                lbl.Text = "<li style=\"list-style-image: url('/Images/rh.gif')\">" + string.Format("{0} <br />", myDataTable.Rows[repeatItem.ItemIndex]["HEADER"]) + "</li>";
                repeatItem.Controls.Add(lbl);

                // Add SeparatorTemplate Dynamically
                //repeaterItem = new RepeaterItem(repeatItem.ItemIndex, ListItemType.Separator);
                //LiteralControl ltrlHR = new LiteralControl();
                //ltrlHR.Text = "<hr />";
                //repeatItem.Controls.Add(ltrlHR);
            }

            // Add Repeater Control as Child Control
            // of Panel Control
            //Panel childPanel = new Panel();
            //childPanel.Controls.Add(Repeater1);
            //return childPanel;
            //return Repeater1;

            StringBuilder sb = new StringBuilder();
            Repeater1.RenderControl(new HtmlTextWriter(new StringWriter(sb)));
            String Text = sb.ToString();
            return Text;
        }


    }
}

Your help would be much appreciated. 

Kind Regards,

Chitra

Ajax Data Table error

$
0
0

Hi,

Im using http://www.datatables.net/ this data table in my MVC application. My DB has huge number of records like 1 lakh above, But this datatable accepting only 5423 Rows.

If i pass >=5424 Rows to that data table, Im getting below error. I searched a lot but couldn't find the solution for this.

Please Help.

Thanks,

Shivanag.

Calendar control and search data datewise by calling a procedure

$
0
0

I have created a search page on which i search data using  a search term.But i also want to create an option where i put calendar control and search data datewsie.

how can i go about it??

thanks

Memory leak with UpdatePanel

$
0
0

Hi,

Below an example of a simple web form with an UpdatePanel, a Button, a Label, a TextBox, and a RequiredFieldValidator. When clicking the button multiple times I can see the memory usage is growing without ever being released.

<%@ Page Language="C#" %><!DOCTYPE html><script runat="server">
    protected void Button1_Click(object sender, EventArgs e)
    {
        Label1.Text = "Refreshed at " + DateTime.Now;
    }</script><html xmlns="http://www.w3.org/1999/xhtml"><head></head><body><form id="form2" runat="server"><div style="padding-top: 10px"><asp:ScriptManager ID="ScriptManager2" runat="server"></asp:ScriptManager><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><fieldset><legend>UpdatePanel</legend><asp:Label ID="Label1" runat="server" Text="Panel created."></asp:Label><br /><asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" /><asp:TextBox ID="TextBox1" runat="server" Text="abcd"></asp:TextBox><asp:RequiredFieldValidator ID="X" runat="server" ControlToValidate="TextBox1"></asp:RequiredFieldValidator></fieldset></ContentTemplate></asp:UpdatePanel></div></form></body></html>

I think the combination UpdatePanel and RequiredFieldValidator is causing the issue. What I found is that the following collections are growing after every postback:
- Sys.WebForms.PageRequestManager._instance._onSubmitStatements
- document.getElementsByTagName('head')[0].childNodes

I tried it in several ASP.NET version, including 4.5.2, with and without UnobtrusiveValidationMode. I do have some code to work around this issue, but it feels like a hack.

Can anybody tell me if this is a known issue and if there is a good way to work around this. Thanks in advance.

Ronald

Viewing all 5678 articles
Browse latest View live




Latest Images