AJAX :: Correctly Derive From A ScriptControl?
Feb 12, 2010
I have a question. How do I correctly derive from a script control? Especially how to correctly define the script descriptors.
Let's say, I have a MyScriptControl class implementing IScriptControl:
[Code]....
In the derived class, how Do I correctly overwrite the GetScriptDescriptors method? Should I just call base.GetScriptDescriptors, enumerate through them and exchange the Type name everywhere? Or is there a more clean feeling approach to that?
View 4 Replies
Similar Messages:
May 21, 2010
I am tryng to decide upon adding custom data to the ViewState dictionary by either deriving from ControllerBase or deriving from ControllerActionInvoker.
View 3 Replies
Oct 21, 2010
I have a ScriptControl (requires ScriptManager) with JavaScript to handle client-side interactions and ICallbackEventHandler to communicate back and forth. Everything works perfectly with one or multiple instances of the control on a page. I placed the control inside a GridView with sorting and it still works. However, I place the GridView in an UpdatePanel and now whenever I sort I get the following error for each instance:
Sys.InvalidOperationException: Two components with the same id 'GridView_ctl02_MyControl' can't be added to the application.
Can someone point me in the right direction on how to solve this? I am assuming ScriptManager is not disposing of the old Sys.UI.Control objects before trying to $create() the new ones with the same ID. I thought the UpdatePanel/ScriptManager combination would automatically take care of disposing objects that would be replaced?
View 1 Replies
Mar 18, 2011
I've got a custom script control, or what I call a composite control with a client side object, that I'm trying to use within a user control. The problem is the user control is changing the control id. So when I wire up the events with the code below the ids are wrong.
comboBox.OnClientLoad = "function(sender, eventArgs){" + Common.FindScriptObject(this.ClientID) + ".ComboBoxLoad(sender,eventArgs); }";
The Common.FindScriptObject code just outputs $find(''). Because it is being used within a user control the client side ids have an some extra lenght to them, like "usercontrol_controlclientId" vs "controlclientId". So how do I get the ids to be correct within a usercontrol?
View 1 Replies
Mar 9, 2011
Not sure if the derived page is actually relevant to the problem here, but ran into an interesting gotcha on some code I'm working through at the moment.
I have a custom masterpage class, which derives from System.Web.UI.MasterPage so that it can be extended with additional useful properties. The page that that uses this masterpage has a declaration at the top (note the Page Title being set).
<%@ Page Language="C#" MasterPageFile="~/MasterPages/Landing.master" AutoEventWireup="true" CodeFile="Index.aspx.cs" Inherits="Index" Title="Welcome to the site" %>
In addition, the master page has stylesheet references in the head which are pulled from a CDN that is defined in a config file.
<head id="Head1" runat="server">
<link rel="stylesheet" type="text/css" href="<%= CDN %>/css/main.css" />
</head>
Now the example above obviously doesn't work, because the runat attribute in the head container means that the codeblock in the the link is static text, and renders as is, in the resulting html.
If I remove the runat attribute from head, the CDN works, but now I notice that the Title is no longer being set. If I debug, and try to access Page.Title in the Immediate Window, I get an exception:
// Using the Title property of Page requires a header control on the page. (e.g. <head runat="server" />).
So, is there a way to get the Page Title from the declaration, put my own title placeholder in the head and set it from the master page code-behind, or, is there a better way to dynamically set the CDN domain for the stylesheets? The only way I think I can do that is to build the entire html link tag(s) and append it to the header control, but I thought there might be a more elegant solution, so I'm asking here first.
View 2 Replies
Oct 20, 2010
I have a ScriptControl that uses an image as an embedded resource and GetWebResourceUrl to generate the WebResource.axd URL. I am currently using GetScriptDescriptors() to send the URL to the JavaScript object.The ScriptControl can be in a Repeater, so you may have 20+ instances. They all use the same images (not customizable through property), so I would like to set the URL once in a variable and share it. I know I could register a script block with a global variable, but would like to avoid that if possible. Is there a way to set a variable within the scope of the control type (global -> control type -> control instance)?
View 1 Replies
Apr 27, 2010
I'm creating a control based on ScriptControl, and I'm overriding the Render method like this:
protected override void Render(HtmlTextWriter writer)
{
RenderBeginTag(writer);
writer.RenderBeginTag(HtmlTextWriterTag.Div);
writer.Write("This is a test.");
writer.RenderEndTag();
RenderEndTag(writer);
}
My question is, what if I want to assign the div an ID attribute and have it be unique on the page, even if there are mulitple instances of my control?
I've seen other people's code that does this:
writer.AddAttribute(HtmlTextWriterAttribute.Id, this.ClientID + "_divTest");
That will prevent naming conflicts between instances of my control, but what if I've already created a div elsewhere on the page that coincidentally has the same ID?
I've also heard about implementing INamingContainer. Would that apply here? How could I use it?
UPDATE:
I've worked around this by overriding CreateChildControls and adding actual controls, as opposed to rendering HTML directly. In that case INamingContainer does its job. However, I'm still curious if there's a way to solve my original problem (unique IDs for directly rendered elements).
View 3 Replies
Aug 3, 2010
I have a user control I created in asp.net 3.5. The user control has some buttons and a modal popup extender inside of it. I have added the control to one of the columns of my gridview. The propblem I am having is when I click on any other button in my control, then click on the button that displays the modal popup(client side), the grayed out modal popup area appears behind the grid, and I cant see nor access my panel. Here is my source for my user control.(I have tried playing with the z-index and other things, but nothing seems to work).
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="ucParcels.ascx.cs" Inherits="UserControls_ucParcels"</textarea></p>
<input type='hidden' name='ID[7]' value='79140' />
<input type='hidden' name='URL[7]' value='http://forums.asp.net/t/1438592.aspx' />
<input type='hidden' name='CAT[7]' value='Visual Studio' />
[code]...
View 1 Replies
Mar 30, 2011
I'm using jQuery to store a value in a HiddenField control that my UpdatePanel can then grab as it's updating to help display the correct data. I've got everything working in Safari, but it doesn't seem like the HiddenField is retaining the correct value for the UpdatePanel in Firefox. In the Async Page Load function I put:
[Code]....
(CurrentHashValue returns the Value property of the HiddenField.) In Safari, I see the correct output, but in Firefox 4, I see it output and empty string for CurrentHashValue on AsyncPostBack. However, if I add an alert in to my JavaScript:
[Code]....
The correct value is displayed. Could this be because the HiddenField is not in the UpdatePanel? I'm not used to seeing such different behavior between Safari and Firefox. Makes me scared to even try it in IE. If you'd like to see this in action, here is the page: [URL]
View 1 Replies
Jun 14, 2010
well my problem is that when i try to include a calendar extender inside a gridview , which is inside a calendar extender, it doesnt appear correctly , here you have an image how it appears , would you mind telling me what is happening please.
View 2 Replies
Apr 4, 2010
I developed a webapp which is working great in IE8, and newer versions of Safari, Opera, Firefox and Chrome. I've noticed that there are many things wrong with the page in IE7. Resizing isn't working properly, margins aren't being set correctly. Floating within a cleared div isn't working property. My unordered lists with a display:inline are not displaying correctly.I'm just not sure where to start with this. I feel like i need to be supporting IE 7. Is this a common issue with other developers?Edit : for example....a page will with div's containing these classes does not work....TreasureContainer
View 1 Replies
Mar 15, 2011
When I add an ajax combobox (WindowsStyle Css) to a web page that uses a masterpage the arrow button is vertically offset from the rest of the combobox. however if I add it to page without masterpage then it works fine.I am using the images and provided css styling provided by ajax toolkit. I tried removing the site css file but that didn't help either. Any ideas what could be causing this? Code is below for a sample in Master/Content Page:
[Code]....
View 3 Replies
Jan 24, 2014
I have a page with an updatepanel, which at runtime has controls dynamically created. The controls are saved within the cache, and readded to the page upon postback each time when needed. Sometimes the controls need to change, sometimes not. In most of my cases, if I just re-add the control to the page without any changes to the control AJAX will leave the control alone on the client-side leaving me with what I expect to see, which is no change. If I make a change, it obviously updates correctly.
Now, I have added a literal control which defines an iFrame which points to another page. ie:
Code:
.LiteralControl.Text = "<iframe name='" & .LiteralControl.ID & "' id='" & .LiteralControl.ClientID & "' frameborder='no' scrolling='auto' height='" & _
.ItemHeight & "px' width='" & .ItemWidth & "px' src='" & "WBRender.aspx?ViewID=" & strUniqueID.ToString & "' style='position: absolute; " & _
"left:" & .ItemLeft & "px; top:" & .ItemTop & "px;'></iframe>"
If I re-add this control on postback, with a change, I get the item on the page as I expect. If I make no changes to the .Text and simply re-add the control to the page, it flashes as though it has been changed and then re-requests the page defined by the src. The whole point of me caching this, is to stop the client-side from updating a control that has not changed, removing a flashing screen and all the resizing that goes with it.
View 1 Replies
Apr 25, 2010
Why might gridview only work correctly after reloading the page in IE? And, why does it work correctly on the first page load in Firefox? How might I solve this problem? I thought of trying to instantly reload the page with Javascript if the browser is IE, but this is kind of a bad workaround.
View 1 Replies
Apr 10, 2010
I am trying to uise the Ajax Toolkit Tab container and Tab Panel controls. I got them working BUT the tabs are on the right side of the web page instead of starting on the left side. I have tried many things to move them to no avail.
I am using a master page and a css style file. By clicking around they moved to where they should be but then after viewing web page went back to right (wrong) side.
<%@ Master Language="VB" CodeFile="MasterPage.master.vb" Inherits="MasterPage" %>
View 1 Replies
Feb 10, 2010
My application has been developed in .net 2.0 platformwith a masterpage which doesn't have 'doctype' and was working fine. Now i had to use modelpopup extender from the Ajax Control Tool Kit 1.0 version. when I use this the popup , it is coming up but the page in the IE shows that this page seems to be increased by indefinite size. I found the reason as it was due to 'Doctype' which is not there in the master page. Later i have added the doctype to my master page, now the popup and everything works fine but the page design has got changed.
View 1 Replies
Oct 18, 2010
I am using a bunch of SliderExtenders to morph the ASP Textbox into a Slider control. This has worked great. However, I noticed that 1/20 times, occasionally, the sliderextender fails to morph the textbox. So the textbox actually appears during initial page_load. However, you can still drag the slider around because it is also rendered beneath the textbox.
A subsequent page refresh fixes this problem until some other time.
Second thing, this also frequently comes out more when switching between a javascript tab and an updatepanel.
View 1 Replies
Apr 29, 2010
I have a display problem when I try to use a ajax combobox inside a tab control: when my tab control loads on the page where the combobox is, everything works fine; however, if it loads on a another page, the you change to the page which contains the combobox, the right button (which opens the list of the combobox) isn't displayed at all.
View 1 Replies
May 19, 2010
My question is similar to "ASP.NET 2 projects to share same files", but with an ASP.NET MVC slant.Basically, we have two sites, one being based mostly on the other (roughly 90% views, controllers, images, in the second are identical to the first). However, in some cases, the views may be different, or a controller in the second site may be different to the first.Are there any simple ways of achieving this in ASP.NET MVC?So far, we've looked at using linked files to have two totally seperate projects where the second project shares the files it needs from the first.One problem with this approach is that most pages in the second project don't literally exist in the virtual directory, it makes debugging a pain - you have to publish in order to generate the files so you can debug.
View 5 Replies
Feb 1, 2010
m using JQuery UI dialog and tabs inside asp.net Update Panel.the dialog worked great until I added following codes for JQuery UI tab.
function pageLoad(sender, args) {
if (args.get_isPartialLoad()) {
$("#tabs").tabs();
}
}
The tabs work fine, but I'm getting duplicate dialog box and it also killed ASP.net Datapager.
View 4 Replies
Mar 29, 2011
I need to get my C# Web Application in VS 2008 Professional to compile. I have 2 projects in one solution.The first project, PowerMeter has an App_Code folder with namespace Inov.PowerMeter and the associated .aspx.cs files in the app reference it by using Inov.PowerMeter;. This code compiles fine and builds the powermeter.dll correctly. I have a second project called QuickMeter. The app_code for this creates a namespace Inov.Quickmeter and the aspx.cs files reference it correctly. But this doesn't compile.
View 1 Replies
Sep 5, 2010
I'm not so much into JavaScript, so I'm not able to use the new CKEditor right away. Until now I was using the FCKEditor ASP.net wrapper, which works fine for me. Unfortunatly the official wrapper is not for version 3.
I've googled [URL] but the project is over a year old and seems like a beta to me.
Is there a stable ASP.net wrapper for the CKEditor available? Or how can I implement it into my ASP.net Webapplication project?
View 1 Replies
May 28, 2010
I want to rotate an image with asp.net. I used TranslateTransform and RotateTransform. After rotation, the image is damaged. How can I solve this problem?
View 1 Replies
Feb 2, 2011
I know this may not be the place, but can anyone provide me with good cart32 support forums or something that people actually check on a daily basis like this forum?I have posted in the yahoogroups for cart32, i have asked for help from the host and cant get good help on this issue.Trying to work with Shipping Types and trying to handle from the code side doesnt work and from the cart configuration doesnt work as expected.. My original post on the other forum can be seen here: [URL]
View 2 Replies
Aug 6, 2010
All implementation of IHttpModule I've seen looks following:
[code]....
I am wondering why is the Dispose method always empty? Shouldn't we unsubscribe the event which we subscribe in the Init method?
View 1 Replies