Search Results

Search found 427 results on 18 pages for 'ascx'.

Page 10/18 | < Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >

  • Could not load type 'System.Web.Mvc.ViewUserControl<SOMETYPE>'.

    - by Evgenyt
    I'm trying to deploy ASP.NET MVC 2 project (VS2010) to Win Server 2008 R2 It works perfectly on dev machine. But strange error occurs at Server 2008 R2: When .ascx file has header that uses generic type: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel>" %> Server reports Could not load type 'System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel>'. But when I declare somewhere in .cs file type like public class AA : System.Web.Mvc.ViewUserControl<MyProj.Web.Models.RangeViewModel> { } and use it instead in <%@ Control header. Then it works as it should. Am I missing something?

    Read the article

  • ASP.Net error: “The type ‘foo’ exists in both ”temp1.dll“ and ”temp2.dll" (pt 2)

    - by Greg
    I'm experiencing the same problem as in this question, but none of the answers fixed my problem. (edit: Setting the web.config batch attribute works, but that's a coverup, not a solution) The problem I'm having is with a User Control that I moved from the root directory to a subdirectory within the same Web Application project. It used to work fine before I moved it. When I moved it it started giving me the error message. It's saying that the class name exists in two dll files in Temporary ASP.NET Files. Sure enough, when I open Reflector, it's in two dlls. If I rename the class and ascx file, everything works fine. No usages of the original name exist within any of the files in my entire application. When I rename the file, I opened all of the dll files in Temporary ASP.NET Files with Reflector, and no references to the original class name exists. So where's this phantom reference coming from how can I fix this?

    Read the article

  • asp.net MVC RC1 RenderPartial ViewDataDictionary

    - by Mark79
    I'm trying to pass a ViewData object from a master page to a view user control using the ViewDataDictionary. The problem is the ViewDataDictionary is not returning any values in the view user control whichever way i try it. The sample code below is using an anonymous object just for demonstration although neither this method or passing a ViewData object works. Following is the RenderPartial helper method i'm trying to use: <% Html.RenderPartial("/Views/Project/Projects.ascx", ViewData.Eval("Projects"), new ViewDataDictionary(new { Test = "Mark" })); %> and in my view user control i do the following: <%= Html.Encode(ViewData["Test"]) %> Why does this not return anything? Thanks for your help. EDIT: I'm able to pass and access the stronlgy typed model without any problems. it's the ViewDataDictionary which i'm trying to use to pass say just a single value outside of the model..

    Read the article

  • Session lost and application end, after file download

    - by Amr ElGarhy
    I have this code in the end of link button click: Response.ContentType = "application/zip"; Response.AppendHeader("content-disposition", "attachment; filename=download.zip"); Response.TransmitFile(Server.MapPath("download.zip")); Response.End(); to download a zip file from an aspx page. In the previous page i set a session variable, after going to this download page and download the file, then press back i find the session=null "this happen after downloading more than 1 time", and the application_end in global.ascx called. Do you know why this may happen??

    Read the article

  • Jquery .ajax async postback on C# UserControl

    - by tnriverfish
    I'm working on adding a todo list to a project system and would like to have the todo creation trigger a async postback to update the database. I'd really like to host this in a usercontrol so I can drop the todo list onto a project page, task page or stand alone todo list page. Here's what I have. User Control "TodoList.ascx" which lives in the Controls directory. The script that sits at the top of the UserControl. You can see where I started building jsonText to postback but when that didn't work I just tried posting back an empty data variable and removed the 'string[] items' variable from the AddTodo2 method. <script type="text/javascript"> $(document).ready(function() { // Add the page method call as an onclick handler for the div. $("#divAddButton").click(function() { var jsonText = JSON.stringify({ tdlId: 1, description: "test test test" }); //data: jsonText, $.ajax({ type: "POST", url: "TodoList.aspx/AddTodo2", data: "{}", contentType: "application/json; charset=utf-8", dataType: "json", success: function(msg) { alert('retrieved'); $("#divAddButton").text(msg.d); }, error: function() { alert("error"); } }); }); });</script> The rest of the code on the ascx. <div class="divTodoList"> <asp:PlaceHolder ID="phTodoListCreate" runat="server"> <div class="divTLDetail"> <div>Description</div> <div><asp:TextBox ID="txtDescription" runat="server"></asp:TextBox></div> <div>Active</div> <div><asp:CheckBox ID="cbActive" runat="server" /></div> <div>Access Level</div> <div><asp:DropDownList ID="ddlAccessLevel" runat="server"></asp:DropDownList></div> </div> </asp:PlaceHolder> <asp:PlaceHolder ID="phTodoListDisplayHeader" runat="server"> <div id="divTLHeader"> <asp:HyperLink ID="hlHeader" runat="server"></asp:HyperLink> </div> </asp:PlaceHolder> <asp:PlaceHolder ID="phTodoListItems" runat="server"> <div class="divTLItems> <asp:Literal ID="litItems" runat="server"></asp:Literal> </div> </asp:PlaceHolder> <asp:PlaceHolder ID="phAddTodo" runat="server"> <div class="divTLAddItem"> <div id="divAddButton">Add Todo</div> <div id="divAddText"><asp:TextBox ID="txtNewTodo" runat="server"></asp:TextBox></div> </div> </asp:PlaceHolder> <asp:Label ID="lbTodoListId" runat="server" style="display:none;"></asp:Label></div> To test the idea I created a /TodoList.aspx page that lives in the root directory. <uc1:TodoList runat="server" ID="tdl1" TodoListId="1" ></uc1:TodoList> The cs for the todolist.aspx protected void Page_Load(object sender, EventArgs e) { SecurityManager sm = new SecurityManager(); sm.MemberLevelAccessCheck(MemberLevelKey.AreaAdmin); } public static string AddTodo2() { return "yea!"; } My hope is that I can have a control that can be used to display multiple todo lists and create a brand new todo list as well. When I click on the #divAddButton I can watch it build the postback in firebug but once it completes it runs the error portion by alerting 'error'. I can't see why. I'd really rather have the response method live inside the user control as well. Since I'll be dropping it on several pages to keep from having to go put a method on each individual page. Any help would be appreciated.

    Read the article

  • ASP.NET MVC Strongly Typed Partial View, gives could not load type error

    - by Matt
    I am attempting to create a strongly typed view with a "MVC View User Control" that is being rendered using Html.RenderPartial(). The top of my ascx file looks like this: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.Collections.IEnumerable<string>>" %> There is nothing else on this page, currently. When I execute the app and load the page that renders this control, I get the following error: Could not load type 'System.Web.Mvc.ViewUserControl<System.Collections.IEnumerable<string>>'. So, then I simplified it: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<String>" %> And then, just in case it needed to be fully qualified: <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.String>" %> Everytime I get the same error (substituting type). what am I doing wrong here? I'm on .NET 3.5 with ASP.NET MVC 1.0 RTM.

    Read the article

  • JavaScript and CSS files for ASP.NET MVC 2 EditorTemplate user controls

    - by Zack Peterson
    I'm using an EditorTemplate DateTime.ascx in my ASP.NET MVC 2 project. <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<DateTime>" %> <%: Html.TextBox(String.Empty, Model.ToString("M/dd/yyyy h:mm tt")) %> <script type="text/javascript"> $(function () { $('#<%: ViewData.TemplateInfo.GetFullHtmlFieldId(String.Empty) %>').AnyTime_picker({ format: "%c/%d/%Y %l:%i %p" }); }); </script> This uses the Any+Time™ JavaScript library for jQuery by Andrew M. Andrews III. I've added those library files (anytimec.js and anytimec.css) to the <head> section of my master page. Rather than include these JavaScript and Cascading Style Sheet files on every page of my web site, how can I instead include the .js and .css files only on pages that need them--pages that edit a DateTime type value?

    Read the article

  • ASP.NET MVC 2 UpdateModel() is not updating values in memory or database

    - by campbelt
    Hello, I am new to MVC, and so am working through the NerdDinner tutorial, here. In particular, I'm running into problems with the use of the UpdateModel method, which is explained in the part five of that tutorial. The problem is, when I try to edit the value of a dinner object using the UpdateModel method, the values do not get updated, and no exceptions are thrown. Oddly, I am not having any trouble with the Create or Delete features that are illustrated in the tutorial. Only the update feature isn't working. Below, I have included the Controller code that I am using, as well as the view markup, which is contained in both an aspx View file and an ascx Partial View file. Here is the code inside my Controller, called DinnerController.cs: // // GET: /Dinners/Edit/2 [Authorize] public ActionResult Edit(int id) { Dinner dinner = dinnerRepository.GetDinner(id); return View(new DinnerFormViewModel(dinner)); } // // POST: /Dinners/Edit/2 [AcceptVerbs(HttpVerbs.Post), Authorize] public ActionResult Edit(int id, FormCollection formValues) { Dinner dinner = dinnerRepository.GetDinner(id); try { UpdateModel(dinner); var x = ViewData.GetModelStateErrors(); // <-- to catch other ModelState errors dinnerRepository.Save(); return RedirectToAction("Details", new { id = dinner.DinnerID }); } catch { ModelState.AddRuleViolations(dinner.GetRuleViolations()); return View(new DinnerFormViewModel(dinner)); } } The line with the comment "to catch other ModelState errors" was added after reading a possible solution from another StackOverflow thread, here: http://stackoverflow.com/questions/1461283/asp-net-mvc-updatemodel-not-updating-but-not-throwing-error Unfortunately, that solution didn't help me. Here is the corresponding markup in my Dinners/Edit.aspx View: <asp:Content ID="Main" ContentPlaceHolderID="MainContent" runat="server"> <h2>Edit Dinner</h2> <% Html.RenderPartial("DinnerForm"); %> </asp:Content> Here is the corresponding markup in my DinnerForm.ascx Partial View. This Partial View file is also used by the Create feature, which is working fine: <%=Html.ValidationSummary("Please correct the errors and try again.") %> <% using (Html.BeginForm()) { %> <fieldset> <p> <label for="Title">Dinner Title:</label> <%=Html.TextBoxFor(model => Model.Dinner.Title)%> <%=Html.ValidationMessage("Title", "*") %> </p> <p> <label for="EventDate">EventDate:</label> <%=Html.TextBoxFor(model => Model.Dinner.EventDate, new { value = String.Format("{0:g}", Model.Dinner.EventDate) })%> <%=Html.ValidationMessage("EventDate", "*") %> </p> <p> <label for="Description">Description:</label> <%=Html.TextBoxFor(model => Model.Dinner.Description)%> <%=Html.ValidationMessage("Description", "*")%> </p> <p> <label for="Address">Address:</label> <%=Html.TextBoxFor(model => Model.Dinner.Address)%> <%=Html.ValidationMessage("Address", "*") %> </p> <p> <label for="Country">Country:</label> <%=Html.DropDownListFor(model => Model.Dinner.Country, Model.Countries)%> <%=Html.ValidationMessage("Country", "*") %> </p> <p> <label for="ContactPhone">ContactPhone #:</label> <%=Html.TextBoxFor(model => Model.Dinner.ContactPhone)%> <%=Html.ValidationMessage("ContactPhone", "*") %> </p> <p> <label for="Latitude">Latitude:</label> <%=Html.TextBoxFor(model => Model.Dinner.Latitude)%> <%=Html.ValidationMessage("Latitude", "*") %> </p> <p> <label for="Longitude">Longitude:</label> <%=Html.TextBoxFor(model => Model.Dinner.Longitude)%> <%=Html.ValidationMessage("Longitude", "*") %> </p> <p> <input type="submit" value="Save"/> </p> </fieldset> <% } %> In any case, I've been hitting away at this for hours, and I'm out of ideas. So, I'm hoping someone here can help nudge me in the right direction, in order to figure out what I'm doing wrong.

    Read the article

  • How to compress CSS/JS in VS2010 Web Deployment Build Template?

    - by RPM1984
    Hi all, We've recently upgraded from VS2008 - VS2010 (and hence upgrading from Web Deployment Project to proper deployment project). Obviously what's new in VS2010 web deployments is the introduction of Workflow as the build process template. Previously, we used a MSBuild task in the WDP to execute the Yahoo YUI Javascript/CSS compression module to minify/compress javascript and css files. Has anyone managed to accomplish this task with Visual Studio 2010? I have seen the new "SquishIt" compressor created by Justin Etheridge, but its not ideal as it "squishes" on the fly (e.g on Application_Start - Global.ascx) - which means you still have to push out all the uncompressed files to your web server before squishing. In the Workflow designer - i can see a toolbox item called "MSBuild" - just dont know how to use it to accomplish what i want. Been searching high and wide, no-one seems to know how. Surely someone out there has done this.

    Read the article

  • Problem showing modelstate errors while using RenderPartialToString

    - by Martin
    Im using the following code: public string RenderPartialToString(ControllerContext context, string partialViewName, ViewDataDictionary viewData, TempDataDictionary tempData) { ViewEngineResult result = ViewEngines.Engines.FindPartialView(context, partialViewName); if (result.View != null) { StringBuilder sb = new StringBuilder(); using (StringWriter sw = new StringWriter(sb)) { using (HtmlTextWriter output = new HtmlTextWriter(sw)) { ViewContext viewContext = new ViewContext(context, result.View, viewData, tempData, output); result.View.Render(viewContext, output); } } return sb.ToString(); } return String.Empty; } To return a partial view and a form through JSON. It works as it should, but as soon as I get modelstate errors my ValidationSummary does not show. The JSON only return the default form but it does not highlight the validation errors or show the validation summary. Am I missing something? This is how I call the RenderPartialToString: string partialView = RenderPartialToString(this.ControllerContext, "~/Areas/User/Views/Account/ChangeAccountDetails.ascx", new ViewDataDictionary(avd), new TempDataDictionary());

    Read the article

  • How to call windows authentication programmatically in sharepoint?

    - by HamdiKavak
    Hi guys, Here is my scenario. When anonymous user visits site collection's default site, custom login form panel is shown. This form is a webUserControl(.ascx file) that is embeded into page as webpart. Then user enters username and password. When submit button has been clicked, authentication will be handled by code behind of custom login form panel. Here is my question. How can I call SharePoint's authentication method with the username and password that is entered by user. Simply, I want users to login through my custom login form panel because default windows authentication window is looking really bad.

    Read the article

  • An Object reference is required for the non-static field

    - by Muhammad Akhtar
    I have make my existing method to static method to get access in javascript, like.. [WebMethod(EnableSession = true), ScriptMethod()] public static void Build(String ID) { Control releaseControl = LoadControl("~/Controls/MyControl.ascx"); //An Object reference is required for the non-static field, mthod or property // 'System.Web.UI.TemplateControl.LoadControl(string)' plc.Controls.Add(releaseControl); // where plc is place holder control //object reference is required for the nonstatic field, method, or property '_Default.pl' } When I build I am getting error and I have posted these in comments below each line before converted it to static method, it working perfectly. Please suggest me the solution of my issue. Thanks

    Read the article

  • getting database connectivity issue from only one part of my ASP.net project?

    - by Greg
    Hi, Something weird has started happening to my project with Dynamic Data. Suddenly I am now getting connection errors when going to the DD navigation pages, but things work fine on the default DD main page, and also other MVC pages I've added in myself work fine to the database. Any ideas? So in summary if I go to the following web pages: custom URL for my custom controller - this works fine, including getting database data main DD page from root URL - this works fine click on a link to a table maintenance page from the main DD page - GET DATABASE CONNECTIVITY ERROR Some items: * I'm using SQL Server Express 2008 * Doesn't seem to be any debug/error info in VS2010 at all I can see * Web config entry: <add name="Model1Container" connectionString="metadata=res://*/Model1.csdl|res://*/Model1.ssdl|res://*/Model1.msl;provider=System.Data.SqlClient;provider connection string=&quot;Data Source=GREG\SQLEXPRESS_2008;Initial Catalog=greg_development;Integrated Security=True;MultipleActiveResultSets=True&quot;" providerName="System.Data.EntityClient"/> Error: Server Error in '/' Application. A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. Exception Details: System.Data.SqlClient.SqlException: A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified) Source Error: Line 39: DropDownList1.Items.Add(new ListItem("[Not Set]", NullValueString)); Line 40: } Line 41: PopulateListControl(DropDownList1); Line 42: // Set the initial value if there is one Line 43: string initialValue = DefaultValue; Source File: U:\My Dropbox\source\ToplogyLibrary\Topology_Web_Dynamic\DynamicData\Filters\ForeignKey.ascx.cs Line: 41 Stack Trace: [SqlException (0x80131904): A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)] System.Data.SqlClient.SqlInternalConnection.OnError(SqlException exception, Boolean breakConnection) +5009598 System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning() +234 System.Data.SqlClient.TdsParser.Connect(ServerInfo serverInfo, SqlInternalConnectionTds connHandler, Boolean ignoreSniOpenTimeout, Int64 timerExpire, Boolean encrypt, Boolean trustServerCert, Boolean integratedSecurity) +341 System.Data.SqlClient.SqlInternalConnectionTds.AttemptOneLogin(ServerInfo serverInfo, String newPassword, Boolean ignoreSniOpenTimeout, TimeoutTimer timeout, SqlConnection owningObject) +129 System.Data.SqlClient.SqlInternalConnectionTds.LoginNoFailover(ServerInfo serverInfo, String newPassword, Boolean redirectedUserInstance, SqlConnection owningObject, SqlConnectionString connectionOptions, TimeoutTimer timeout) +239 System.Data.SqlClient.SqlInternalConnectionTds.OpenLoginEnlist(SqlConnection owningObject, TimeoutTimer timeout, SqlConnectionString connectionOptions, String newPassword, Boolean redirectedUserInstance) +195 System.Data.SqlClient.SqlInternalConnectionTds..ctor(DbConnectionPoolIdentity identity, SqlConnectionString connectionOptions, Object providerInfo, String newPassword, SqlConnection owningObject, Boolean redirectedUserInstance) +232 System.Data.SqlClient.SqlConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningConnection) +185 System.Data.ProviderBase.DbConnectionFactory.CreatePooledConnection(DbConnection owningConnection, DbConnectionPool pool, DbConnectionOptions options) +33 System.Data.ProviderBase.DbConnectionPool.CreateObject(DbConnection owningObject) +524 System.Data.ProviderBase.DbConnectionPool.UserCreateRequest(DbConnection owningObject) +66 System.Data.ProviderBase.DbConnectionPool.GetConnection(DbConnection owningObject) +479 System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection) +108 System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory) +126 System.Data.SqlClient.SqlConnection.Open() +125 System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +52 [EntityException: The underlying provider failed on Open.] System.Data.EntityClient.EntityConnection.OpenStoreConnectionIf(Boolean openCondition, DbConnection storeConnectionToOpen, DbConnection originalConnection, String exceptionCode, String attemptedOperation, Boolean& closeStoreConnectionOnFailure) +161 System.Data.EntityClient.EntityConnection.Open() +98 System.Data.Objects.ObjectContext.EnsureConnection() +81 System.Data.Objects.ObjectQuery`1.GetResults(Nullable`1 forMergeOption) +46 System.Data.Objects.ObjectQuery`1.System.Collections.Generic.IEnumerable<T>.GetEnumerator() +44 System.Data.Objects.ObjectQuery`1.GetEnumeratorInternal() +36 System.Data.Objects.ObjectQuery.System.Collections.IEnumerable.GetEnumerator() +10 System.Web.DynamicData.Misc.FillListItemCollection(IMetaTable table, ListItemCollection listItemCollection) +50 System.Web.DynamicData.QueryableFilterUserControl.PopulateListControl(ListControl listControl) +85 Topology_Web_Dynamic.ForeignKeyFilter.Page_Init(Object sender, EventArgs e) in U:\My Dropbox\source\ToplogyLibrary\Topology_Web_Dynamic\DynamicData\Filters\ForeignKey.ascx.cs:41 System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e) +14 System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e) +35 System.Web.UI.Control.OnInit(EventArgs e) +91 System.Web.UI.UserControl.OnInit(EventArgs e) +83 System.Web.UI.Control.InitRecursive(Control namingContainer) +140 System.Web.UI.Control.AddedControl(Control control, Int32 index) +197 System.Web.UI.ControlCollection.Add(Control child) +79 System.Web.DynamicData.DynamicFilter.EnsureInit(IQueryableDataSource dataSource) +200 System.Web.DynamicData.QueryableFilterRepeater.<Page_InitComplete>b__1(DynamicFilter f) +11 System.Collections.Generic.List`1.ForEach(Action`1 action) +145 System.Web.DynamicData.QueryableFilterRepeater.Page_InitComplete(Object sender, EventArgs e) +607 System.EventHandler.Invoke(Object sender, EventArgs e) +0 System.Web.UI.Page.OnInitComplete(EventArgs e) +8871862 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +604 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.1

    Read the article

  • ASP.NET MVC ajax - data transfer

    - by Grienders
    How can I get result from action? I need to show the commentID on the page (aspx) after successes comment insert. controller [AcceptVerbs(HttpVerbs.Post )] public ActionResult ShowArticleByAjax(Guid id, string commentBody) { Guid commentID = Comment.InsertComment(id, commentBody); //How can I tranfer commentID to the aspx page ??? return PartialView("CommentDetails",Article.GetArticleByID(id)); } ascx <%using (Ajax.BeginForm("ShowArticleByAjax", new { id = Model.ID }, new AjaxOptions { HttpMethod = "Post", UpdateTargetId = "divCommentDetails", OnSuccess = "successAddComment", OnFailure = "failureAddComment", OnBegin = "beginAddComment" })) { %> <p> <%=Html.TextArea("commentBody", new { cols = "100%", rows = "10" })%> </p> <p> <input name="submit" type="image" src="../../Content/Images/Design/button_s.gif" id="submit" /> </p> <%} %> aspx doesn't matter

    Read the article

  • ASP.NET User Control Value

    - by Steven
    I created a DatePicker user control (ASP code below, no code behind) which is simply a textbox, image button, and a sometimes visible calendar. <%@ Control Language="vb" AutoEventWireup="false" _ CodeBehind="myDatePicker.ascx.vb" Inherits="Website.myDate" %> <%@ Register assembly="AjaxControlToolkit" namespace="AjaxControlToolkit" _ tagprefix="asp" %> <asp:TextBox ID="Date1" runat="server"></asp:TextBox> <asp:Image ID="Image1" runat="server" ImageUrl="~/Calendar_scheduleHS.png" /> <asp:CalendarExtender ID="Date1_CalendarExtender" runat="server" Enabled="True" TargetControlID="Date1" PopupButtonID="Image1" > </asp:CalendarExtender> Can I somehow tie or pass the value of the TextBox as the value of the whole control to use in the calling code?

    Read the article

  • AJAX Partial page update problem when displaying a control

    - by Jernej Goricki
    Hello! I have an interesting problem when using partial page update in asp.net with scriptmanager and a update panel. My scenario looks like this: I'm using the tab control from the ajax toolkit. I also implemented this control using lazy loading, so that when the page is loaded only the current tab gets loaded all the other tabs don't get rendered, because Im using an UpdatePanel (on a .ascx control) on each of these tabs and when a tab gets selected the updatepanel makes a async postback to load the content for a selected tab. On one of my tabs Im using a combobox control from obout.com, and it doesn't work. Now I know why it doesn't work. It doesn't work because the control is shown via a partial page refresh, but to correctly display the control it has to do some "magic" that is - register some .css and .js includes on the page (in the head I guess)....but because I load this control via async page refresh...it can't do these stuff. What kind of workarround do you suggest? Thanks!

    Read the article

  • Saving State Dynamic UserControls...Help!

    - by Cognitronic
    I have page with a LinkButton on it that when clicked, I'd like to add a Usercontrol to the page. I need to be able to add/remove as many controls as the user would like. The Usercontrol consists of three dropdownlists. The first dropdownlist has it's auotpostback property set to true and hooks up the OnSelectedIndexChanged event that when fired will load the remaining two dropdownlists with the appropriate values. My problem is that no matter where I put the code in the host page, the usercontrol is not being loaded properly. I know I have to recreate the usercontrols on every postback and I've created a method that is being executed in the hosting pages OnPreInit method. I'm still getting the following error: The control collection cannot be modified during DataBind, Init, Load, PreRender or Unload phases. Here is my code: Thank you!!!! bool createAgain = false; IList<FilterOptionsCollectionView> OptionControls { get { if (SessionManager.Current["controls"] != null) return (IList<FilterOptionsCollectionView>)SessionManager.Current["controls"]; else SessionManager.Current["controls"] = new List<FilterOptionsCollectionView>(); return (IList<FilterOptionsCollectionView>)SessionManager.Current["controls"]; } set { SessionManager.Current["controls"] = value; } } protected void Page_Load(object sender, EventArgs e) { Master.Page.Title = Title; LoadViewControls(Master.MainContent, Master.SideBar, Master.ToolBarContainer); } protected override void OnPreInit(EventArgs e) { base.OnPreInit(e); System.Web.UI.MasterPage m = Master; Control control = GetPostBackControl(this); if ((control != null && control.ClientID == (lbAddAndCondtion.ClientID) || createAgain)) { createAgain = true; CreateUserControl(control.ID); } } protected void AddAndConditionClicked(object o, EventArgs e) { var control = LoadControl("~/Views/FilterOptionsCollectionView.ascx"); OptionControls.Add((FilterOptionsCollectionView)control); control.ID = "options" + OptionControls.Count.ToString(); phConditions.Controls.Add(control); } public event EventHandler<Insight.Presenters.PageViewArg> OnLoadData; private Control FindControlRecursive(Control root, string id) { if (root.ID == id) { return root; } foreach (Control c in root.Controls) { Control t = FindControlRecursive(c, id); if (t != null) { return t; } } return null; } protected Control GetPostBackControl(System.Web.UI.Page page) { Control control = null; string ctrlname = Page.Request.Params["__EVENTTARGET"]; if (ctrlname != null && ctrlname != String.Empty) { control = FindControlRecursive(page, ctrlname.Split('$')[2]); } else { string ctrlStr = String.Empty; Control c = null; foreach (string ctl in Page.Request.Form) { if (ctl.EndsWith(".x") || ctl.EndsWith(".y")) { ctrlStr = ctl.Substring(0, ctl.Length - 2); c = page.FindControl(ctrlStr); } else { c = page.FindControl(ctl); } if (c is System.Web.UI.WebControls.CheckBox || c is System.Web.UI.WebControls.CheckBoxList) { control = c; break; } } } return control; } protected void CreateUserControl(string controlID) { try { if (createAgain && phConditions != null) { if (OptionControls.Count > 0) { phConditions.Controls.Clear(); foreach (var c in OptionControls) { phConditions.Controls.Add(c); } } } } catch (Exception ex) { throw ex; } } Here is the usercontrol's code: <%@ Control Language="C#" AutoEventWireup="true" CodeBehind="FilterOptionsCollectionView.ascx.cs" Inherits="Insight.Website.Views.FilterOptionsCollectionView" %> namespace Insight.Website.Views { [ViewStateModeById] public partial class FilterOptionsCollectionView : System.Web.UI.UserControl { protected void Page_Load(object sender, EventArgs e) { } protected override void OnInit(EventArgs e) { LoadColumns(); ddlColumns.SelectedIndexChanged += new RadComboBoxSelectedIndexChangedEventHandler(ColumnsSelectedIndexChanged); base.OnInit(e); } protected void ColumnsSelectedIndexChanged(object o, EventArgs e) { LoadCriteria(); } public void LoadColumns() { ddlColumns.DataSource = User.GetItemSearchProperties(); ddlColumns.DataTextField = "SearchColumn"; ddlColumns.DataValueField = "CriteriaSearchControlType"; ddlColumns.DataBind(); LoadCriteria(); } private void LoadCriteria() { var controlType = User.GetItemSearchProperties()[ddlColumns.SelectedIndex].CriteriaSearchControlType; var ops = User.GetItemSearchProperties()[ddlColumns.SelectedIndex].ValidOperators; ddlOperators.DataSource = ops; ddlOperators.DataTextField = "key"; ddlOperators.DataValueField = "value"; ddlOperators.DataBind(); switch (controlType) { case ResourceStrings.ViewFilter_ControlTypes_DDL: criteriaDDL.Visible = true; criteriaText.Visible = false; var crit = User.GetItemSearchProperties()[ddlColumns.SelectedIndex].SearchCriteria; ddlCriteria.DataSource = crit; ddlCriteria.DataBind(); break; case ResourceStrings.ViewFilter_ControlTypes_Text: criteriaDDL.Visible = false; criteriaText.Visible = true; break; } } public event EventHandler OnColumnChanged; public ISearchCriterion FilterOptionsValues { get; set; } } }

    Read the article

  • RenderPartial from different folder in RAZOR

    - by Dien
    I've been trying to convert my aspx pages to cshtml and having an issue with rendering partial pages from another folder. What I used to do: <% Html.RenderPartial("~/Views/Inquiry/InquiryList.ascx", Model.InquiryList.OrderBy("InquiryId", MvcContrib.Sorting.SortDirection.Descending));%> I would think that the equivalent would be: @Html.RenderPartial("~/Views/Inquiry/_InquiryList.cshtml", Model.InquiryList.OrderBy("InquiryId", MvcContrib.Sorting.SortDirection.Descending)) This is obviously not working, I am getting the following error. CS1973: 'System.Web.Mvc.HtmlHelper' has no applicable method named 'Partial' but appears to have an extension method by that name. Extension methods cannot be dynamically dispatched. Consider casting the dynamic arguments or calling the extension method without the extension method syntax. How would I achieve this with using the Razor view engine?

    Read the article

  • jQuery ajax in DotNetNuke preserving user authentication

    - by Michael Bradley
    I want to use jQuery's ajax functionality in a DotNetNuke module I'm developing. I want the ajax call to be authenticated via DNN's membership functionality. I want the ajax response as json. How can I do this? I've looked at IWeb and IWebCF -- it's not clear to me from much Googleing and scanning the forums whether these modules would allow me to create a web service that would accept a simple post request and return json (seems like they want to do it the ASP.NET AJAX way with a generated proxy, I'd prefer to just use jQuery's AJAX call functionality). Seems you can't create a simple webmethod in a DNN module (since they are developed as User Controls (.ascx)). I could deploy an .asmx file with module, but that won't leverage DNN's authentication system. Ideas? I'm currently developing against DNN 4.9.5

    Read the article

  • ASP.net - First build fails with 'Unknown server tag'

    - by Sophia
    I have multiple custom controls used on a ASPX (and C#) page registered from within the page rather than in Web.Config. On the first build (or rebuild), build fails with error messages for wherever I've used the custom controls. Subsequent builds are successful. The error message: Unknown server tag 'prefix:ExampleControl'. What might cause this, and how can I fix it? Register syntax: <%@ Register Src="ControlsFolder/ExampleControl.ascx" TagName="ExampleControl" TagPrefix="prefix" %> <!-- etc --> Usage syntax: <prefix:ExampleControl runat="server" ID="ExampleControl1" /> <!-- etc -->

    Read the article

  • PHP session starter detect for visitor counting

    - by zapping
    Is there a way to find out on session being started. Like for instance the session start event in the global.ascx file of .net. The requirement is to find the no. of visits the user has done on the site. Instead of checking each time during posts or gets to the server. Is there something in php to find out if the session is a new one. Zen framework is also used for the app.

    Read the article

  • How powerful is the <script> tag in ASP.NET ?

    - by MarceloRamires
    I'm new at web development with .NET, and I'm currently studying a page where I have both separated codebehinds (in my case, a .CS file associated to the ASPX file), and codebehind that is inside the ASPX file inside tags like this: <script runat="server"> //code </script> Q1:What is the main difference (besides logical matters like organization, readability and ETC), what could be done in one way that could not be done in another? What is each mode best suited for ? Q2:If I'm going to develop a simple page with database connection, library imports, access to controls (ascx) and image access in other folders.. which method should I choose ?

    Read the article

  • Javascript Intellisense not working on Visual Studio 2010 Ultimate (Windows 7 x64)

    - by emzero
    Hi guys, I've just got the new Visual Studio 2010 Ultimate and Javascript Intellisense is not working on .aspx/.ascx files inside blocks. It does work on external .js files. After VS2010 setup, it asked me if I wanted to import the settings from previous VS version (I have VS2008 SP1 installed), I say yes. I've tried resetting the settings like explained here. Didn't work. I've also installed Resharper 5. I thought it might be conflicting, so I tried suspending it like it says here. Didn't work. Anyone experiencing the same issue? I really want javascript/jQuery intellisense =(

    Read the article

  • add ms ajax accordion pane at runtime loses previous pane issue

    - by Chris Conway
    I have an AjaxControlToolkit accordion control that i'm trying to load panes at runtime. When I click a button inside a listview, it should add a new pane to the accordion control. Here is the code that adds the pane in the onitemcommand event within the listview var pane = new AccordionPane { ID = key }; pane.HeaderContainer.Controls.Add(new LiteralControl(label.Text)); pane.ContentContainer.Controls.Add(LoadControl("~/UserControls/Covers/" + e.CommandArgument + ".ascx")); accordion.Panes.Add(pane); And this will successfully show a webcontrol inside the accordion control. But when I click on another button in the listview, the accordion is reset and it only shows the new pane instead of appending a new pane. Is there any way to keep the previous pane visible across postbacks like this? By the way, each of the webcontrols that are loaded in the accordion have input fields that will need to be persisted across postbacks as well. thanks!

    Read the article

  • C# MVC: User Password Reset Controller: Issues with email addresses as usernames

    - by 109221793
    Hi guys, I have written the code below for resetting users passwords (am using the aspnet membership api) in an C# MVC application, and tested successfully on a sample tutorial application (MVC Music Store). Skip to the end if you wish to read problem description first. InactiveUsers View (Partial View) <%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<System.Web.Security.MembershipUserCollection>" %> <table class="normal" style="width: 100%; background-color: White;"> <tr> <th>User Name</th> <th>Last Activity date</th> <th>Locked Out</th> </tr> <%foreach (MembershipUser user in Model){ %> <tr> <td><%: Html.RouteLink(user.UserName, "AdminPassword", new { username = user.UserName }) %></td> <td><%: user.LastActivityDate %></td> <td><%: user.IsLockedOut %></td> </tr> <% }%> </table> InactiveUsers Controller public ActionResult InactiveUsers() { var users = Membership.GetAllUsers(); return View(users); } changeUserPassword GET and POST Controllers public ActionResult changeUserPassword(string username) { ViewData["username"] = username; return View(); } [HttpPost] public ActionResult changeUserPassword(ChangePasswordModel model, FormCollection values) { string username = values["username"]; string password = values["password"]; string confirmPassword = values["confirmPassword"]; MembershipUser mu = Membership.GetUser(username); if (password == confirmPassword) { if (mu.ChangePassword(mu.ResetPassword(), password)) { return RedirectToAction("Index", "ControlPanel"); } else { ModelState.AddModelError("", "The current password does not meet requirements"); } } return View(); } I also modified the Global.asax.cs file to cater for my route in the InactiveUsers partial: // Added in 10/01/11 RouteTable.Routes.MapRoute( "AdminPassword", // routename "ControlPanel/changeUserPassword/{username}", new { controller = "ControlPanel", action = "changeUserPassword", username = UrlParameter.Optional } ); // END Now, when I tested on the MVC Music Store, all of my usernames were just words, e.g. Administrator, User, etc. However now I am applying this code to a situation in my workplace and it's not working out quite as planned. The usernames used in my workplace are actually email addresses and I think this is what is causing the problem. When I click on the RouteLink in the partial InactiveUsers view, it should bring me to the reset password page with a url that looks like this: http://localhost:83/ControlPanel/changeUserPassword/[email protected], HOWEVER, what happens when I click on the RouteLink is an error is thrown to say that the view changeUserPassword cannot be found, and the URL looks like this: http://localhost:83/ControlPanel/changeUserPassword/example1%40gmail.com - See how the '@' symbol gets messed up? I've also debugged through the code, and in my GET changeUserPassword, the username is populating correctly: [email protected], so I'm thinking it's just the URL that's messing it up? If I type in the URL manually, the changeUserPassword view displays, however the password reset function does not work. An 'Object reference not set to an instance of an object' exception is thrown at the if (mu.ChangePassword(mu.ResetPassword(), password)) line. I think if I could solve the first issue (URL '@' symbol problem) it might help me along with my second issue. Any help would be appreciated :) Stack Trace - as requested Source Error: An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below. Stack Trace: [InvalidOperationException: The view 'changeUserPassword' or its master was not found. The following locations were searched: ~/Views/ControlPanel/changeUserPassword.aspx ~/Views/ControlPanel/changeUserPassword.ascx ~/Views/Shared/changeUserPassword.aspx ~/Views/Shared/changeUserPassword.ascx] System.Web.Mvc.ViewResult.FindView(ControllerContext context) +495 System.Web.Mvc.ViewResultBase.ExecuteResult(ControllerContext context) +208 System.Web.Mvc.ControllerActionInvoker.InvokeActionResult(ControllerContext controllerContext, ActionResult actionResult) +39 System.Web.Mvc.<>c__DisplayClass14.<InvokeActionResultWithFilters>b__11() +60 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultFilter(IResultFilter filter, ResultExecutingContext preContext, Func`1 continuation) +391 System.Web.Mvc.<>c__DisplayClass16.<InvokeActionResultWithFilters>b__13() +61 System.Web.Mvc.ControllerActionInvoker.InvokeActionResultWithFilters(ControllerContext controllerContext, IList`1 filters, ActionResult actionResult) +285 System.Web.Mvc.ControllerActionInvoker.InvokeAction(ControllerContext controllerContext, String actionName) +830 System.Web.Mvc.Controller.ExecuteCore() +136 System.Web.Mvc.ControllerBase.Execute(RequestContext requestContext) +111 System.Web.Mvc.ControllerBase.System.Web.Mvc.IController.Execute(RequestContext requestContext) +39 System.Web.Mvc.<>c__DisplayClass8.<BeginProcessRequest>b__4() +65 System.Web.Mvc.Async.<>c__DisplayClass1.<MakeVoidDelegate>b__0() +44 System.Web.Mvc.Async.<>c__DisplayClass8`1.<BeginSynchronous>b__7(IAsyncResult _) +42 System.Web.Mvc.Async.WrappedAsyncResult`1.End() +141 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +54 System.Web.Mvc.Async.AsyncResultWrapper.End(IAsyncResult asyncResult, Object tag) +40 System.Web.Mvc.MvcHandler.EndProcessRequest(IAsyncResult asyncResult) +52 System.Web.Mvc.MvcHandler.System.Web.IHttpAsyncHandler.EndProcessRequest(IAsyncResult result) +38 System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +8841105 System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +184

    Read the article

< Previous Page | 6 7 8 9 10 11 12 13 14 15 16 17  | Next Page >