Showing posts with label solution. Show all posts
Showing posts with label solution. Show all posts

Wednesday, March 28, 2012

VERY new to asp.net AJAX: Enabling controls based on slection from AutoComplete control

I've been reading all day and I'm not finding the solution to my requirement.

I'm developing a form to enter "lead" information, part of the lead data is the name of their Dr. We maintain a MySql DB with leads and Drs information.

When a user is entering a new lead and they type the last name of the Dr I have a AutoCompleteExtension fetching Dr.s that match the last name. When/if the user selects a Dr. from the list I want to DISABLE the other Dr. related fields (FName, address, etc) and insert the data from the selected Dr. If there is no match found, the user will enter the details for the Dr. (new record).

The main issue I'm struggling with is how to respond (client or server) to the user making a selection from the AutoComplete list and enable/disable and populate the related fields. For example, the user picks a Dr. from the list, I then want to disable all the Dr. detail related fields and set the values with the record from the database.

I'm not sure how I will accomplish this yet, I imagine I would need to set those values from the server side and it would in turn use AJAX to push the values down to the client?

If anyone could give me a little guidance I would really appreciate it, I just need a jump start to get this thing going.

Thanks for reading,
Steve


If you're Textbox that has the AutoComplete extention on it loses focus, why not use the onBlur event to check to see if they used your AutoComplete (which would have text in that textbox). If they did use the AutoComplete, then use JavaScript to disable the other textboxes.


You could use the ItemSelected event of the AutoComplete extender in the client and as RTernier says use JavaScript to disable the other textboxes, you could call a webservice to obtain the remaining information of the doctor, check: http://www.asp.net/ajax/documentation/live/tutorials/ExposingWebServicesToAJAXTutorial.aspx
http://www.asp.net/ajax/documentation/live/tutorials/EmbedScriptFile.aspx For information on using WebServices. You could also use an UpdatePanel, I guess you could call a partial post back from the ItemSelected event, although I'm not an expert in UpdatePanel, but I think it would work (personally I like the webservice way better, but it's a matter of choice).

Saturday, March 24, 2012

Warning1Could not resolve this reference. Could not locate the assembly "System.Web.Extens

I just downloaded the latest version of the toolkit and tried to run the solution in vs 2005 and this is one of the many errors I'm getting while trying to run the project. Does anyone have any idea how to fix this?

Warning 1 Could not resolve this reference. Could not locate the assembly "System.Web.Extensions.Design, Version=1.0.61025.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL". Check to make sure the assembly exists on disk. If this reference is required by your code, you may get compilation errors. AjaxControlToolkit

Hi Mohaaron,

Please make sure that Asp.Net 2.0 Ajax Extensions V1.0 has been installed. If not , please reference tothis document. Ajax Control Toolkit is seperated for working on .NET Framework2.0 and .NET Framework 3.5. So please double check it.

I hope this help.

Best regards,

Jonathan

Watermark Extender and Calendar extender do not work together?

Hi,

I'm wondering if anyone has come up with a solution for this problem. I have a textbox with a Watermark Extender attached to it. I also have a calendar extender attached to that same textbox.

When the page loads the watermark is there as it should. When I click on the textbox the watermark disappears and the calendar launches. So far so good. It seems as though when I click on a calendar date it flashes the date in the textbox then goes back to the watermark.

Are these two controls not able to work together?

Thank you

Vear

We have a bug tracking changes in textbox watermark so that it plays well with other extenders like calendar, masked edit and validators. This should be fixed when that issue is resolved.

Thanks kirtid,

I look forward to the update. I thought I was perhaps doing something wrong.

Vear

WCF ASP.NET Service not working - what am I missing

Hello. This is a simple question, so please take a look.

I am using Orcas Beta2 and I created a new Solution. In there added a Web Application Project. In the project I created an Ajax enabled WCF service. When I call the service from JavaScript I get this error: Service1 is not defined. What am I missing? Here is the very simple code. Thanks!

default.aspx:

<%@dotnet.itags.org. Page Language="C#" AutoEventWireup="true" CodeBehind="Default.aspx.cs" Inherits="WebApplication1._Default" %
<!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>
<script type="text/javascript">
function Hello() {
WebApplication1.Service1.HelloWorld(onComplete, onTimeout);
}
function onComplete(result) {
alert(result);
}
function onTimeout(result) {
alert("Timed out!");
}
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<input type="button" value="Call Hello" onclick="Hello()" />
</div>
</form>
</body>
</html>

namespace WebApplication1
{
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1
{
// Add [WebGet] attribute to use HTTP GET
[OperationContract]
public string HelloWorld()
{
return "helooo";
}
}
}

code for the service:

namespace WebApplication1
{
[ServiceContract]
[AspNetCompatibilityRequirements(RequirementsMode = AspNetCompatibilityRequirementsMode.Allowed)]
public class Service1
{
// Add [WebGet] attribute to use HTTP GET
[OperationContract]
public string HelloWorld()
{
return "helooo";
}
}
}

web.config (this is generated by VS2008 and i did not modify it):

<?xml version="1.0"?>
<configuration>
<configSections>
<sectionGroup name="system.web.extensions" type="System.Web.Configuration.SystemWebExtensionsSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<sectionGroup name="scripting" type="System.Web.Configuration.ScriptingSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="scriptResourceHandler" type="System.Web.Configuration.ScriptingScriptResourceHandlerSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<sectionGroup name="webServices" type="System.Web.Configuration.ScriptingWebServicesSectionGroup, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35">
<section name="jsonSerialization" type="System.Web.Configuration.ScriptingJsonSerializationSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="Everywhere"/>
<section name="profileService" type="System.Web.Configuration.ScriptingProfileServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="authenticationService" type="System.Web.Configuration.ScriptingAuthenticationServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
<section name="roleService" type="System.Web.Configuration.ScriptingRoleServiceSection, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" requirePermission="false" allowDefinition="MachineToApplication"/>
</sectionGroup>
</sectionGroup>
</sectionGroup>
</configSections>
<appSettings/>
<connectionStrings/>
<system.web>
<!--
Set compilation debug="true" to insert debugging
symbols into the compiled page. Because this
affects performance, set this value to true only
during development.
-->
<compilation debug="true">
<assemblies>
<add assembly="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Data.DataSetExtensions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
<add assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add assembly="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089"/>
</assemblies>
</compilation>
<!--
The <authentication> section enables configuration
of the security authentication mode used by
ASP.NET to identify an incoming user.
-->
<authentication mode="Windows"/>
<!--
The <customErrors> section enables configuration
of what to do if/when an unhandled error occurs
during the execution of a request. Specifically,
it enables developers to configure html error pages
to be displayed in place of a error stack trace.

<customErrors mode="RemoteOnly" defaultRedirect="GenericErrorPage.htm">
<error statusCode="403" redirect="NoAccess.htm" />
<error statusCode="404" redirect="FileNotFound.htm" />
</customErrors>
-->
<pages>
<controls>
<add tagPrefix="asp" namespace="System.Web.UI" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add tagPrefix="asp" namespace="System.Web.UI.WebControls" assembly="System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</controls>
</pages>
<httpHandlers>
<remove verb="*" path="*.asmx"/>
<add verb="*" path="*.asmx" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="*" path="*_AppService.axd" validate="false" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35" validate="false"/>
</httpHandlers>
<httpModules>
<add name="ScriptModule" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</httpModules>
</system.web>
<system.codedom>
<compilers>
<compiler language="c#;cs;csharp" extension=".cs" compilerOptions="/warnaserror-" warningLevel="4" type="Microsoft.CSharp.CSharpCodeProvider, System, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<providerOption name="CompilerVersion" value="v3.5"/>
</compiler>
</compilers>
</system.codedom>
<!--
The system.webServer section is required for running ASP.NET AJAX under Internet
Information Services 7.0. It is not necessary for previous version of IIS.
-->
<system.webServer>
<validation validateIntegratedModeConfiguration="false"/>
<modules>
<add name="ScriptModule" preCondition="integratedMode" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</modules>
<handlers>
<remove name="WebServiceHandlerFactory-Integrated"/>
<add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
<add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=3.5.0.0, Culture=neutral, PublicKeyToken=31BF3856AD364E35"/>
</handlers>
</system.webServer>
<system.serviceModel>
<behaviors>
<endpointBehaviors>
<behavior name="WebApplication1.Service1AspNetAjaxBehavior">
<enableWebScript/>
</behavior>
</endpointBehaviors>
</behaviors>
<serviceHostingEnvironment aspNetCompatibilityEnabled="true"/>
<services>
<service name="WebApplication1.Service1">
<endpoint address="" behaviorConfiguration="WebApplication1.Service1AspNetAjaxBehavior" binding="webHttpBinding" contract="WebApplication1.Service1"/>
</service>
</services>
</system.serviceModel>
</configuration>

Thanks!

Checkout the following post:
http://odetocode.com/Blogs/scott/archive/2007/07/30/11171.aspx


Yep, I'm guessing this is what you're missing. Afraid you can't get away with just .html as the client. You'll have to create an .aspx page.

Factory="System.ServiceModel.Activation.WebScriptServiceHostFactory" %>


Thanks Kazi,

I tried this and ran into other problems. See http://forums.asp.net/p/1170276/1956960.aspx#1956960

I thought that the default out of the box experience should be easy. It seems that it is not and one needs to fully understand te WCF model before getting anything to work. And WCF is a big monster to learn just to expose a simple REST service.


Jonathan,

Sorry for cutting and pasting only part of the aspx file. i updated the post and included all of the aspx file. Yes, i am using an aspx file and not an html file. Otherwise it would not compile. I tried adding the Factory to the svc file but it did not work for other reasons. It would be nice if someone, (hello Microsoft! :)) would post steps to create a simple service and how to consume it via an aspx page. This was dead simple in asmx, but wcf has just too many knobs and it seems that detailed knowledge of wcf is required to get this to work.


Thanks!

Wednesday, March 21, 2012

Web Part moves only once with Ajax Update Panel RC1

I uset Web part with Update Panel RC1.

But only once DND possible.

Next time it is not available.....

Can anybody have solution for this.??

Try to specify post back through the triggers of the asp:UpdatePanel.
Here are some sample codes for your reference.
<div>
<asp:ScriptManager ID="ScriptManager1" runat="server" EnablePartialRendering="true">
</asp:ScriptManager>
<asp:UpdatePanel ID="upPortal" runat="server" ChildrenAsTriggers="false" UpdateMode="Conditional">
<ContentTemplate>
<asp:WebPartManager ID="wpmPortal" runat="server" Personalization-Enabled="true">
</asp:WebPartManager>
<div class="wrapper">
<asp:CatalogZone ID="czPortal" runat="server">
</asp:CatalogZone>
</div>
<div class="wrapper">
<div id="wz1">
<asp:WebPartZone ID="WebPartZone2" runat="server" HeaderText="Column 1">
<ZoneTemplate>
<asp:Wizard ID="Wizard1" runat="server">
<WizardSteps>
<asp:WizardStep ID="WizardStep1" runat="server" Title="Step 1">
</asp:WizardStep>
<asp:WizardStep ID="WizardStep2" runat="server" Title="Step 2">
</asp:WizardStep>
</WizardSteps>
</asp:Wizard>
<%--<uc1:ThemeSelector ID="ThemeSelector1" runat="server" EnableTheming="True" />--%>
</ZoneTemplate>
</asp:WebPartZone>
</div>
<div id="wz2">
<asp:WebPartZone ID="WebPartZone3" runat="server" HeaderText="Column 2">
<ZoneTemplate>
<asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="Black"
DayNameFormat="Shortest" Font-Names="Times New Roman" Font-Size="10pt" ForeColor="Black"
Height="220px" NextPrevFormat="FullMonth" TitleFormat="Month" Width="312px">
<SelectedDayStyle BackColor="#CC3333" ForeColor="White" />
<TodayDayStyle BackColor="#CCCC99" />
<SelectorStyle BackColor="#CCCCCC" Font-Bold="True" Font-Names="Verdana" Font-Size="8pt"
ForeColor="#333333" Width="1%" />
<DayStyle Width="14%" />
<OtherMonthDayStyle ForeColor="#999999" />
<NextPrevStyle Font-Size="8pt" ForeColor="White" />
<DayHeaderStyle BackColor="#CCCCCC" Font-Bold="True" Font-Size="7pt" ForeColor="#333333"
Height="10pt" />
<TitleStyle BackColor="Black" Font-Bold="True" Font-Size="13pt" ForeColor="White"
Height="14pt" Font-Names="Arial" />
</asp:Calendar>
</ZoneTemplate>
</asp:WebPartZone>
</div>
<div id="wz3">
<asp:WebPartZone ID="WebPartZone4" runat="server">
<ZoneTemplate>
<asp:Login ID="Login1" runat="server">
</asp:Login>
<asp:Login ID="Login2" runat="server">
</asp:Login>
</ZoneTemplate>
</asp:WebPartZone>
</div>
</div>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="czPortal" />
<asp:PostBackTrigger ControlID="WebPartZone2" />
<asp:PostBackTrigger ControlID="WebPartZone3" />
<asp:PostBackTrigger ControlID="WebPartZone4" />
</Triggers>
</asp:UpdatePanel>
</div
Wish the above can help you.

I tried this before only

But the problem is Page get refresh evrytime when u Drag & Drop the webparts.

then whts the use of UpdatePanel?

Give solution for this...

thnxSmile


If you want to drag&drop webparts, you should specify post back foy them.Otherwise they can't work in Ajax RC 1.0 inder asynchronous post back.I am not sure if ajax:DragPanelExtender is suitable to you.If yes,you can refer to the following sample codes.
<div>
<div style="width: 407px; height: 227px; background-image:url(images\airplane.bmp);background-repeat: no-repeat; border: 5px solid gray">
<table style="width: 250px;">
<tr>
<td style="font-family: Gill Sans MT; font-weight: bold; font-size: 12pt; padding-left: 5px;color: white; height: 41px;">? Room View<hr />
</td>
</tr>
<tr>
<td>
<asp:Panel ID="pnl" runat="server">
<div runat="server" id="headerdiv" style="width: 70px; height: 15px; display: block;
background-image: url(images/Graphics.gif); font-size: 7pt; color: Black; font-family: Arial;
text-align: right; padding-right: 5px; border: 1px solid black; cursor: move;
float: left; font-weight: bold; z-index: 200" onmouseover="showDiv()" onmouseout="hideDiv()">
...dragable
</div>
<br />
<div id="MainPicture" runat="server" style="width: 100px; height: 100px; overflow: visible;
background-color: inherit; cursor: move; vertical-align: middle; text-align: center;"
onmouseover="showDiv()" onmouseout="hideDiv()">
<img runat="server" id="picturemain" alt="room view" src="http://pics.10026.com/?src=images/Amazon.gif"
style="width: 250px; height: 150px; border-right: 5px solid black; border-bottom: 5px solid black;
border-top: 1px solid silver; border-left: 1px solid silver" />
</div>
</asp:Panel>
</td>
</tr>
</table>
</div>
<Ajax:DragPanelExtender ID="DragPanelExtender1" runat="server" DragHandleID="MainPicture" TargetControlID="pnl">
</Ajax:DragPanelExtender>
</div
Wish the above can help you.

thnx for replying...Smile

But I can't revert back now....

I have to wait for final release of MS Ajax

Thnx once againSmile


I have the same problem. It is pretty annoying, this was my first try with atlas. I saw demos with webparts without postback.

What is actually the problem? A broken atlas framework has been released?

Would the next version of Atlas fix this problem?

Would an older version of Atlas be useful and where to download it.

This topic is important!


Just forget about it!

Ajax drag and drop will NOT be supported, even in the final release of Atlas.

Only Orcas will support that.


When Oracs will be released??


Hi,

chetan.sarode:

When Oracs will be released??

Last thing I heard was the 3rd quarter of this year. You can already download a CTP:http://www.microsoft.com/downloads/details.aspx?familyid=1ff0b35d-0c4a-40b4-915a-5331e11c39e6&displaylang=en&tm.

Grz, Kris.