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

Update Progress control with link button and hyperlink

$
0
0

I have a web page with bunch of hyperlinks on it. Sometimes it takes time in redirecting so I put the updateprogress control on my web page. The update progress control does not seem to work. I cannot put the System.Threading.thread.sleep to test the code because all the code is on aspx page.

Is their anyway I can make the update progress control to work.

 


AJAXValidatorCalloutExtender not render CSS properly

$
0
0

I'm using a ValidatorCalloutExtender on a RequiredFieldValidator and decided to change the style from the default to a more 'Modern UI'. I found a wonderful post http://www.imaginativeuniversal.com/blog/post/2008/09/04/Styling-the-Validator-Callout-Extender.aspx Which helped me get all the relevant CSS fields. I proceeded to change the style and was very happy with the result. I tested in IE, Chrome, and FireFox and it worked perfectly. I then Installed on the production server and noticed the CSS is NOT rendered correctly, no matter which browser I use.

Rendered Differently

I have included my CSS below (Just incase I've done something wrong).

/* AjaxControlToolkit Validator */
.validatorCalloutHighlight 
{
	border:solid;
	border-color: #FFCC00;
    /*background-color: lemonchiffon;*/ 
}
.ajax__validatorcallout_popup_table
{
	/*position:absolute;*/
	min-width: 350px;
	min-height: 40px;
	/*padding: 8px;*/
	background: #FFCC00;
	-webkit-border-radius: 0px;
	-moz-border-radius: 0px;
	border-radius: 0px;
	margin-left:250px;
	margin-top:-20px;
	color:black;
}
.ajax__validatorcallout_popup_table:after
{
	content: '';
	position:absolute;
	border-style: solid;
	border-width: 20px 20px 0 0;
	border-color: #FFCC00 transparent transparent transparent;
	display: block;
	width: 0;
	bottom: -20px;
	left: 0px;
}
/* The popup table row */
.ajax__validatorcallout_popup_table_row
{

}
/* The callout cell */
.ajax__validatorcallout_callout_cell
{

}
/* The table in the callout cell */
.ajax__validatorcallout_callout_table
{

}
/* The callout table row */
.ajax__validatorcallout_callout_table_row
{

}
/* The error message cell */
.ajax__validatorcallout_error_message_cell
{

}
/* The warning icon cell */
.validator_callout .ajax__validatorcallout_icon_cell
{
	padding:0px;
}
.validator_callout .ajax__validatorcallout_icon_cell img
{
	/* Remove the 'Warning' icon */
	display: none;
}
/* The close button cell */
.ajax__validatorcallout_close_button_cell
{

}
/* The arrow cell */
.ajax__validatorcallout_arrow_cell
{
	display:none;
}
/* Inner div of a cell. Used in the close button */
.ajax__validatorcallout_innerdiv 
{

}

The ASP code is below

<asp:TextBox ID="txtUsername" runat="server" Width="300px"></asp:TextBox><asp:RequiredFieldValidator CssClass="validator_callout" ID="reqvalUsername" runat="server" ControlToValidate="txtUsername" Display="None" ErrorMessage="Enter a new login name" ValidationGroup="Submit">*</asp:RequiredFieldValidator><cc1:ValidatorCalloutExtender ID="reqvalUsername_ValidatorCalloutExtender" runat="server" CloseImageUrl="~/Images/Buttons/cancel_Validator.png" HighlightCssClass="validatorCalloutHighlight" TargetControlID="reqvalUsername" PopupPosition="TopRight" WarningIconImageUrl="~/Images/Status/clear.png"></cc1:ValidatorCalloutExtender>

I even went so far as to alter the web.config with a custom header, which did not resolve my problem. http://stackoverflow.com/questions/1867383/css-renders-differently-on-web-server-than-on-development-environment

<system.webServer><httpProtocol><customHeaders><clear /><add name="X-UA-Compatible" value="IE=Edge" /></customHeaders></httpProtocol></system.webServer>

I would very much like to use the new style and feel that like it is only something small I've overlooked, but I'm out of ideas on how to resolve this. Could anybody please assist with this frustrating problem?

Pop up custom calculator child window with few values

$
0
0

Hi,

I have done a window design code as below and it is a CHILD window that trigger by a button at PARENT form. So now, i am able to return 1 value and set to the parent's text box. How if i wan to pass more value back to the parent text field?  any suggestion?

Here the code for parent window

 protected void Page_Load(object sender, EventArgs e)
        {
            string cal = @"PopUp('Calculator.aspx?ctrl=ctl00_PlaceHolderMain_txtProposeAir')";

            this.btnCal.Attributes.Add("onclick", cal);
}

Here the code for Child window

<script type="text/javascript">

        function close()
        {
            window.close();
        }

        function DHLupdateParent()
        {
            var total= document.getElementById('<%= txtDHLTotal.ClientID%>').value;
            window.opener.document.getElementById('<%= Request["ctrl"] %>').value = total;
            //return total;
            //window.close();
        }

        function TNTupdateParent() {
            var total = document.getElementById('<%= txtTNTTotal.ClientID%>').value;
            window.opener.document.getElementById('<%= Request["ctrl"] %>').value = total;
            //return total;
           // window.close();
        }

        function TNTTotal(fuleSurchage)
        {
            document.getElementById('<%= txtTNTTotal.ClientID%>').value = fuleSurchage + parseFloat(document.getElementById('<%= txtTNTRate.ClientID%>').value) + parseFloat(document.getElementById('<%= txtTNTSecurityCharge.ClientID%>').value);
        }

        function tntfuleSurchage(tntSecurityCharge)
        {
            var securityCharge = parseFloat(document.getElementById('<%= txtTNTSecurityCharge.ClientID%>').value);
            var importCharge = parseFloat(document.getElementById('<%= txtTNTImportCharge.ClientID%>').value);
            var Rate = parseFloat(document.getElementById('<%= txtTNTRate.ClientID%>').value);
            var fuleSurchageRate = parseFloat(document.getElementById('<%= txtTNTFuleRate.ClientID%>').value);

            var fuleSurchage = (securityCharge + importCharge + Rate) * fuleSurchageRate / 100;
            document.getElementById('<%= txtTNTFuleCharge.ClientID%>').value = fuleSurchage;
            TNTTotal(fuleSurchage);

        }

        function tntSecurityCharge()
        {
            var weight = parseFloat(document.getElementById('<%= txtTNTWeight.ClientID%>').value);
            var rate = parseFloat(document.getElementById('<%= txtTNTSecurityRate.ClientID%>').value);

            document.getElementById('<%= txtTNTSecurityCharge.ClientID%>').value = rate * weight;
            tntfuleSurchage(rate * weight);
        }

        function ComputeCosts(dhlfuleSurchage)
        {
            var dhlrate = parseFloat(document.getElementById('<%= txtDHLRate.ClientID%>').value);

            document.getElementById('<%= txtDHLTotal.ClientID%>').value = dhlrate + dhlfuleSurchage;
        }

        function dhlfuleSurchage()
        {
            var fuleRate = parseFloat(document.getElementById('<%= txtDHLFuleRate.ClientID%>').value);
            var dhlrate = parseFloat(document.getElementById('<%= txtDHLRate.ClientID%>').value);

            var surcharge = parseFloat(document.getElementById('<%= txtDHLFule.ClientID%>').value = fuleRate * dhlrate / 100);
            ComputeCosts(surcharge);
        }</script><form id="form1" runat="server"><div><fieldset><legend>DHL</legend><table width="100%"><tr><td>Weight (KG)</td><td><asp:TextBox runat="server" ID="txtDHLWeight" Text="0.00"/></td></tr><tr><td>Rate</td><td><asp:TextBox runat="server" onkeyup="ComputeCosts();" Text="0.00" ID="txtDHLRate" /></td></tr><tr><td>Fule Surcharges</td><td><asp:TextBox runat="server" onkeyup="dhlfuleSurchage();" Text ="0.00" Enabled="false" ID="txtDHLFule" /></td><td>Current Fule Rate</td><td><asp:TextBox runat="server" onkeyup="dhlfuleSurchage();" Text="0.00" ID="txtDHLFuleRate" /></td></tr><tr><td>Total (RM)</td><td><asp:TextBox runat="server" ID="txtDHLTotal" Text="0.00" /></td></tr><tr><td><asp:Button ID="Proposed" runat="server" Text="Button" OnClientClick="javascript:DHLupdateParent();" /></td></tr></table></fieldset><fieldset><legend>TNT</legend><table width="100%"><tr><td>Weight (KG)</td><td><asp:TextBox runat="server" ID="txtTNTWeight" Text="0.00" onkeyup="tntSecurityCharge();"/></td></tr><tr><td>Rate</td><td><asp:TextBox runat="server" ID="txtTNTRate" Text="0.00" /></td></tr><tr><td>Import Charges</td><td><asp:TextBox runat="server" Text="0.00" ID="txtTNTImportCharge" /></td></tr><tr><td>Security Charges</td><td><asp:TextBox runat="server" Text="0.00" ID="txtTNTSecurityCharge" onkeyup="tntSecurityCharge();" /></td><td>Charge Rate/KG</td><td><asp:TextBox runat="server" ID="txtTNTSecurityRate" Text="0.21" /></td></tr><tr><td>Fuel Surcharges</td><td><asp:TextBox runat="server" Text="0.00" ID="txtTNTFuleCharge" Enabled="false" /></td><td>Current Fule Rate</td><td><asp:TextBox runat="server" ID="txtTNTFuleRate" Text="0.00" onkeyup="tntfuleSurchage();" /></td></tr><tr><td>Total (RM)</td><td><asp:TextBox runat="server" Text="0.00" ID="txtTNTTotal" /></td></tr><tr><td><asp:Button ID="Button1" runat="server" Text="Button" OnClientClick="javascript:TNTupdateParent();" /></td></tr></table></fieldset><table><tr><td><asp:Button ID="Button2" runat="server" Text="Button" OnClientClick="javascript:close();" /></td></tr></table></div></form>

Asp.net controls after UpdateProgress - sometimes works, sometimes not

$
0
0

Hi there,

I meet the issue that  Asp.net controls which should show after the updateprogress finished are sometimes shown, some times not!
Asp.net 4.5.1 / c# / IIS 7.5 / IE10

Flow:

- The user is filling a form and submitting the data via a lablebutton.
- An UpdateProgress is shown
-- Some c# code is launched to handle things in backround
-- A logfile is updated
- A table within a (<p> tag, which is hidden on startup) displays the result of the c# operations ( -- that does not work always -- )

Frontend:

  ...<p></p><h2>Last step:</h2><p></p><p>                 <span class="labelcnt"><asp:LinkButton ID="lbtnCreateUser" runat="server" ClientIDMode="Static" EnableViewState="False" CausesValidation="True" OnClick="lbtnCreateUser_Click">&rsaquo;&rsaquo;&nbsp;Create User.</asp:LinkButton></span>                               </p>           <p runat="server" id="AppFeedbackUI" visible="false"> <h2>Result:</h2><br /><asp:Label ID="lblAppFeedback" runat="server"></asp:Label>                                        <span class="labelcnt" title="Click to emtpy the fields and create a new user."><asp:LinkButton ID="lbtnRestartApp" runat="server" ClientIDMode="Static" EnableViewState="False" CausesValidation="false" OnClick="lbtnRestartApp_Click">&rsaquo;&rsaquo;&nbsp;Restart.</asp:LinkButton></span>                        </p></ContentTemplate></asp:UpdatePanel><asp:UpdateProgress ID="UpdateProgress1" runat="server" AssociatedUpdatePanelID="UpdatePanelusr"><ProgressTemplate><div class="PleaseWait">
                Working, one moment ...</div></ProgressTemplate></asp:UpdateProgress>      </asp:Content>

 

-------------------------------------------------------------------------------------------------------------------------------------------------------------------
Update on 2015-01-23 (11:00 AM, GMT+8)

As testing purpose I have replaced the

<p runat="server" id="AppFeedbackUI" visible="false"> 

against

<asp:Panel runat="server" id="AppFeedbackUI" visible="false" ClientIDMode="Static" EnableViewState="False">

The result is the same - sometimes it works, sometimes not.
-------------------------------------------------------------------------------------------------------------------------------------------------------------------

 


Backend:

            UpdateLog(adobj, retvalad, objContentMsgad);                      
            AppFeedbackUI.Visible = true;
            string appfeedback = "";

            foreach (var pair in AppFeedback)                            
                appfeedback += "<tr><td>" + pair.Key + "</td><td>" + pair.Value + "</td></tr>";

            string tblcss = "rslttablegood";
            if (appfeedback.Contains("not") || appfeedback.Contains("Not"))            
                tblcss = "rslttablesoso";
            if (appfeedback.Contains("xception") || appfeedback.Contains("code line"))            
                tblcss = "rslttablebad";                            
            lblAppFeedback.Text = "<table class=" + tblcss + ">" + appfeedback + "</table>";         

Many thanks for your suggestions!!

Ruben

Enable / Disable a control in ModelPopupExtender with Stream

$
0
0

Hi

i am working on a Itextsharp pdf. i have button in my ModelPopUpExtender called"Print". in this button i am creating and printing new pdf document. everything is working fine. i also have two more buttons called "Accept" and "Not Accept", both are disable when page loads. my requirement is when i press Print button, along with the printing of pdf document "Accept" and "Not accept" button get Enable. i tried almost all ways to get it work :(. there is definitely aconflict with pdf document stream. my code is as under.

<asp:Panel ID="Panel1" runat="server" Style="background-color: #F8FBE9; display: nosne;">
<table width="500px">
<tr>
<td >
Sales form
</td>
</tr>
<tr>
<td>
<table>
<tr>
<td>
<asp:LinkButton ID="btnAccptChk" runat="server" ValidationGroup="grpCCForm" OnClick="btnAccptChk_Click"
Enabled="false"><img src="../images/AcceptCheck.png" alt="Accept" /></asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="btnNotaccptChk" runat="server" ValidationGroup="grpCCForm" Enabled="false"><img src="../images/NotAcceptCheck.png" alt="Accept"/></asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="btnPrint" runat="server" ValidationGroup="grpCCForm" OnClick="btnPrint_Click" OnClientClick="alert('test');"> <img src="../images/Print.bmp" alt="Print" /></asp:LinkButton>
</td>
<td>
<asp:LinkButton ID="btnExit" runat="server" OnClick="btnExit_Click"> <img src="../images/Exit.bmp" /></asp:LinkButton>
</td>
</tr>
</table>
</td>
</tr>
<tr>
</asp:Panel>

<asp:ModalPopupExtender ID="mdlForm" runat="server" TargetControlID="btnopen" BackgroundCssClass="modalBackground"
PopupControlID="Panel1" CancelControlID="btnClose">
</asp:ModalPopupExtender>

in UpdatePanel i have following code.

<Triggers>
<asp:PostBackTrigger ControlID="btnPrint" />
</Triggers>

on Server side in Print_Click Event follwing code is written.

var document = new Document(PageSize.LETTER, 0, 0, 0, 0);

// Create a new PdfWrite object, writing the output to a MemoryStream
var output = new MemoryStream();
var writer = PdfWriter.GetInstance(document, output);
var basefont = BaseFont.CreateFont("c:\\windows\\fonts\\tahoma.ttf", BaseFont.CP1252, BaseFont.NOT_EMBEDDED);

//Create our paragraph
Paragraph PrAmount1 = new Paragraph();

PrAmount1.Add(new Chunk("Test Paragraph", CellFont));
PrAmount1.Add(Chunk.NEWLINE);
col.AddText(PrAmount1);
col.Go();

writer.CloseStream = false;
document.Close();
output.Position = 0;

Response.ContentType = "application/pdf";
Response.AddHeader("Content-Disposition", string.Format("attachment;filename=Receipt-{0}.pdf", txtNextCheckNo.Text));
Response.BinaryWrite(output.ToArray());


btnAccptChk.Enabled = true;
btnNotaccptChk.Enabled = true;

When i try enable code in any other button on the popup it work fine. but with pdf stream it is not. Anybody please help me to solve this problem. Thanks in Advance.

Full Page is refreshed

$
0
0

Hi All,

  I have used the randomly used Image in AdRotator Control. While changing the image, the page every time refreshed. Please help to solve this issue.

Thanks in Advance...

ajaxFileUpload " The data does not correspond to valid JSON. Parameter name: data" error

$
0
0

hello guys,

i try to use ajaxuploadfile to upload multi file but i got bellow error

Sys.Webforms.PageRequestManagerServerErrorException actual cause (related RoleManager issue)

$
0
0

I finally figured out what is causing the Sys.WebForms.PageRequestManagerServerErrorException. Here are the details of my research:

It's probably a bug in the RoleManagerModule . The issue is that the RoleManagerModule, (which comes into picture when the role manager is enabled in the config) tries to add its cookie to Response's cookie collection. This is done in the EndRequest event of the Application. It should actually do it in the PreSendRequestHeaders event because the PreSendRequestHeaders is the last opportunity to modify the response headers. Under normal circumstances the  PreSendRequestHeaders  gets fired after the EndRequest event, but when Response.Flush is called the sequence may be reversed.

Now, the changes made in AJAX RTM which causes this issue are in PageRequestManager.RenderFormCallback function. When EventValidation is enabled in the page, the function calls Response.Flush (which causes the header to be sent). In this case the Application's EndRequest event is fired after the headers have been sent so an exception occurs in RoleManagerModule when it tries to send the response headers. This eventually leads to the page manager parser exception on the client side because the error response is appended to the actual response sent by the partial update.

There are three possible workarounds:

1. Disable caching of cookies in the RoleManager. For custom modules append cookies in the PreSendRequestHeaders event and not EndRequest event.

2. Handle the Application's Error event to clear the error from the Context selectively.

void Application_Error(object sender, EventArgs e)
{
  //There should be some checking done so that not all the errors
  //are cleared
  Context.ClearError();
}

 3. Disable EventValidation in the web form.

"C#" EnableEventValidation="false" %>
  <%@ Page Language="C#" EnableEventValidation="false" %> 

The issue can be repro'ed easily by setting a cookie in the EndRequest event:

void Application_EndRequest(object sender, EventArgs e)
{
  Response.Cookies.Add(new HttpCookie("Test", "Test"));
}

And the following simple page will cause the issue:

 

<%@ Page Language="C#" EnableEventValidation="true" %><!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>Untitled Page</title></head><body><form id="form1" runat="server"><div><asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager> </div><asp:UpdatePanel ID="UpdatePanel1" runat="server"><ContentTemplate><asp:Button ID="Button1" runat="server"  Text="Button" /><asp:Label ID="Label1" runat="server" Text="Label"></asp:Label></ContentTemplate></asp:UpdatePanel></form></body></html>
 

Javascript Ajax call not firing, struggling to debug.

$
0
0

I apologise in advance as this is a noob question but this is the first time I have done Ajax and I cannot get it to work. I'm hoping that some experienced person on here might just look at it and know whats wrong with it straight away.

My javascript code is:

function UpdateStudent(e) {
       name = $("#txtName").val();
       fee = $("#txtFee").val();$.ajax({
           type: "POST",
           url: "StudentWebService.asmx/UpdateStudent",
           data: "{'WorkplanID':'" + id + "', 'WPUser':'" + name + "', 'Task':'" + fee + "'}",
           contentType: "application/json; charset=utf-8",
           dataType: "json",
           success: function (response) { //success: alert('success') works
               var result = response.d;
               alert('Success');
               if (result > 0) {$("#name", row).text(name);$("#fee", row).text(fee);
                   row.removeClass("highlightRow");
                   CloseEditStudentDialog();
               }
               else {
                   alert('There is some error during update');
               }
           },
           failure: function (msg) {
               alert(msg);
           }
       });
       return false;
   }

Is there anything obvisouly wrong with that? When I click update button nothing happens. Or is there a way I can debug this properly? In IE developer mode it just highlights the whol ajax code and then bypasses it as though it runs. But nothing happens - the CloseEditStudentDialog never gets fired.

I know the webs service works because in VS2010 if I run the web service code it lets me enter and update values no problem. Here is my c# code if needed. Many thanks for any help.

[WebMethod]
    public int UpdateStudent(int WorkplanID, string WPUser, string Task)
    {
        SqlConnection con = null;
        //string constr = @"Server=TestServer; Database=SampleDB; uid=waqas; pwd=123";
        string constr = System.Configuration.ConfigurationManager.ConnectionStrings["PublicHealthCMSConnectionString"].ConnectionString;
        string query = "UPDATE Workplan SET WPUser = @WPUser, Task = @Task WHERE WorkplanID = @WorkplanID";

        con = new SqlConnection(constr);
        SqlCommand command = new SqlCommand(query, con);
        command.Parameters.Add("@WPUser", SqlDbType.VarChar).Value = WPUser;
        command.Parameters.Add("@Task", SqlDbType.VarChar).Value = Task;
        command.Parameters.Add("@WorkplanID", SqlDbType.Int).Value = WorkplanID;

        int result = -1;
        try
        {
            con.Open();
            result = command.ExecuteNonQuery();
        }
        catch (Exception)
        { }
        finally
        {
            con.Close();
        }
        return result;
    }    

I should say the id variable is defined and populated earlier.

Many thanks

What is the best practices method of uploading multiple files to a web server by a user?

$
0
0

I know I can use the asp.net fileUpload control to upload files. I see that html5 "file" has built-in capabilities as well. I am looking for the best practices method of doing it and interested in others opinions.

what is ajax

AjaxControlToolkit

$
0
0

Hi,

I'm newbie in AjaxControlToolkit.

I'm using Visual Studio 2013, ans Install AjaxControlToolkit via nuget.

I'm trying to do a collapsible panel.

I've tried a lot af example, but no example work!!!!

My first question is:

- What is the difference between "ScriptManager" and "ToolScriptManager"?

I have my ScriptManager  my master page, is it a problem?

I've tried example for newbie, but it still does'nt work, I don't saw what's the problem....

Is there an issue installing by nuget?

I don't understand and seem to be very bad....

If anyone could help me, I'll be so happy!!

Thanks...

PS: I've tried with collapsible panel examples...

upload file by ajax

$
0
0

I wrote a project to upload a file, but it don't work.

can some on help me with this?

I upload my code to onedrive see link below ,so you guys can reproduce the issue easily.

http://1drv.ms/15K0PV6 

And this time ,DON'T DELETE MY QUESTION. i am searching for answer in this forum for a week but still no answer.

'get' works but 'post' do not work

$
0
0
<script>
        var xmlhttp;
        function loadXmlDoc() {
            if (window.XMLHttpRequest) {
                xmlhttp = new XMLHttpRequest();
            }
            else {
                xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
            }

            xmlhttp.onreadystatechange = function () {
                if (xmlhttp.readyState == 4 && xmlhttp.status == 200)
                {
                    document.getElementById('div').innerHTML = xmlhttp.responseText;
                }
            }

            xmlhttp.open('get', '../TextFile1.txt', true);  //change get to post not work, why????
            xmlhttp.send();
        };
     
    </script>

ajax autolist get ID

$
0
0

i implement Ajax autoList on textbox, but when want insert into database how to get the selected row id. What is the syntax to get the selected row id?

<asp:TextBox ID="txtName" runat="server" CssClass="textbox" autocomplete="on" 
            AutoPostBack="True" ></asp:TextBox><asp:AutoCompleteExtender ID="txtName_AutoCompleteExtender" runat="server" 
            CompletionInterval="0" DelimiterCharacters="" Enabled="True" 
            FirstRowSelected="True" MinimumPrefixLength="1" 
            ServiceMethod="GetCompletionList" ServicePath="../AutoList.asmx" TargetControlID="txtName" 
            EnableCaching="true" ShowOnlyCurrentWordInCompletionListItem="True" CompletionListCssClass="completionList"></asp:AutoCompleteExtender>
 public string[] GetCompletionList(string prefixText, int count)
        {
            DataSet ds = new DataSet();
            DataTable dt = new DataTable();
            try
            {
                using (conn)
                {
                    MySqlCommand SqlComm = new MySqlCommand("Select * from customer Where CustName like @param", conn);
                    SqlComm.Parameters.AddWithValue("@param", "%" + prefixText + "%");
                    conn.Open();
                    SqlComm.ExecuteNonQuery();
                    MySqlDataAdapter da = new MySqlDataAdapter(SqlComm);
                    da.Fill(ds);
                }
            }
            catch
            {
            }
            finally
            {
                conn.Close();
            }

            dt = ds.Tables[0];
            List<string> txtItems = new List<string>();
            String dvValues;

            foreach (DataRow row in dt.Rows)
            {
                dvValues = row["CustName"].ToString();
                dvValues = dvValues.ToLower();
                txtItems.Add(dvValues);
            }
            return txtItems.ToArray();
        }




AJAX AutoCompleteExtender

$
0
0

Hi everyone,

I am using AJAX AutoCompleteExtender on a TextBox and have a problem in regard to passing the Completion List value(from the Auto complete list generated by the AutoCompleteExtender) to the TextBox.

Let me explain how my Web Form is organized.

I have got a text box that searches people in an organisation. Auto complete provides suggestions as the user starts typing the text. As people can have the same name, the list displayed includes their department as well to help the user find the exact person.

Now, when the user selects an item, I want the value that is passed to the text box to beonly the name of the person because clicking on search button queries the database where name='text in the textbox'. If department is also passed, the search query fails.

Or another thing that I could do with is : when the user selects an item, can i fire a query and skip the press of the search button all together?

Please point me to any related link or source.
Thanks.

If you were creating a new web app, dealing exclusively with video, would you use mvc or web form?

$
0
0

I haven't created an MVC app before, but am considering it over Web Forms.  It will be exclusively using video and images, and am interested in others opinions.

Thanks!

using jquery ajax with onblur event but not working

$
0
0

I am having two asp textboxes, TextBoxPicPostCode and TextBoxPicAddress. The goal of this task is that when i enter a post code inTextBoxPicPostCode and the focus gets lost from this textbox it should automatically populateTextBoxPicAddress using the method in code behind(.cs code). The methodgetadd() in .cs code works fine and uses google api but i am not getting an idea how to use jquery ajax with it.

.cs code:

public void getadd()
    {
        string address = "";
        //_Address.InnerText = _PostCode.Text;
        XmlDocument xDoc = new XmlDocument();
        xDoc.Load("http://maps.google.com/maps/api/geocode/xml?address=" + TextBoxPicPostCode.Text + "&sensor=false");
        XmlNodeList distanceX = xDoc.GetElementsByTagName("formatted_address");
        if (distanceX.Count > 0)
        {
            address = distanceX[0].InnerXml;
            TextBoxPicAddress.Text = address;
        }
    }
<div class="vote"></div> <div> <div class="post-text" itemprop="text">

I am having two asp textboxes, TextBoxPicPostCode and TextBoxPicAddress. The goal of this task is that when i enter a post code inTextBoxPicPostCode and the focus gets lost from this textbox it should automatically populateTextBoxPicAddress using the method in code behind(.cs code). The methodgetadd() in .cs code works fine and uses google api but i am not getting an idea how to use jquery ajax with it.

.cs code:

public void getadd()
    {
        string address = "";
        //_Address.InnerText = _PostCode.Text;
        XmlDocument xDoc = new XmlDocument();
        xDoc.Load("http://maps.google.com/maps/api/geocode/xml?address=" + TextBoxPicPostCode.Text + "&sensor=false");
        XmlNodeList distanceX = xDoc.GetElementsByTagName("formatted_address");
        if (distanceX.Count > 0)
        {
            address = distanceX[0].InnerXml;
            TextBoxPicAddress.Text = address;
        }
    }

.aspx code which i have tried so far and it does not work:

<script type="text/javascript">

                            function submit()
                            {
                                $.ajax({
                                    type: "POST",
                                    url: "Establishment_Controller.aspx.cs/getadd",
                                    data: dataValue,
                                    contentType: 'application/json; charset=utf-8',
                                    dataType: 'json',

                                    success: function (result) {
                                        alert("We returned: " + result.d);
                                    }
                                });
                            }

                        </script><asp:TextBox ID="TextBoxPicPostCode" onblur="submit();" CssClass="time" runat="server"></asp:TextBox><asp:TextBox ID="TextBoxPicAddress"  CssClass="address" runat="server"></asp:TextBox>

</div></div>

How to embed/combine/merge ajax client scripts and .axd into aspx or AS .js in asp.net project

$
0
0

Hi,

Our require is to combine/merge the ajax client scripts and .axd code which all produce by Ajax (Script Manager + update panel) so that it is available in our asp.net project instead of downloading at runtime.  we have issue with malwares and adwares so that we require the same.

Or run client scripts from server?

Thanks.

PageMethods revisited...

$
0
0

Hi,

I've red the entire thread : PageMethods and now I'm here with this issue that PageMethods is undefined or today after 9 years there's an error message in Visual Studio 2013 Community sayingCannot find name 'PageMethods'.  The image below is showing the error and this is a Typescript file but I tried a .JS directly and I get the same problem

http://1drv.ms/1ze8nJr

The ASPX has the ScriptManager, it has the EnablePageMethods="true", the method ispublic static with the WebMethod attribute as it should and the javascript is added in the header so I really don't see why PageMethods isn't recognized in JS

Viewing all 5678 articles
Browse latest View live




Latest Images