Search Results

Search found 87 results on 4 pages for 'browsable'.

Page 1/4 | 1 2 3 4  | Next Page >

  • WPF toolkit DataGrid show filds even with browsable attribute set to false

    - by Jonathan
    Hi Hi have an observable collection that I bind to a DataGrid using the itemsource property of the DataGrid. All the properties of the class inside the collection are displayed properly in the DataGrid. Now, I want to hide some fields to the DataGrid using the browsable attribute [Browsable(false)] in the class. It works well in winforms, but it seems not working in WPF. Someone knows why? I can hide the columns later, but I don't want to loss performance in this way. Is there any other solution? Thanks.

    Read the article

  • Flagging complex properties as Browsable in the compact framework

    - by Rowland Shaw
    I'm working on a compact framework project and whilst most of the properties are fairly straight forward (I.e. mark them as browsable in the xmta file), I'm struggling to get this to work for more complex types - on the full framework, I'd just implement a custom TypeConverter and go from there, but it seems the CF TypeConverter doesn't have any of the type converting methods to override, which has left me a little stuck? It probably should be blindingly obvious but how would I go about supporting design time property support for more complex types (for the sake of argument, assume I can already convert to and from a string, but I'd prefer to keep this strongly typed, rather than just pretend it was a string and parse it both ways. Where should I be looking to achieve this?

    Read the article

  • Proper usage (best practices) of Browsable attribute in .NET for runtime grid component behavior

    - by Dan
    I understand how Browsable attribute is supposed to work. It's supposed to hide a property from showing up in a PropertyGrid in design time. It also has another effect in that it will stop a Property from showing up in components such as Grids, or specifically Infragistics WinGrid. I am not sure if it has this behaviour on regular Windows Forms grids. This works, but it doesn't sound like Browsable is being use as intended when being used for 'Run time' displaying of a property on a grid component. Any literature from Microsoft on proper use. Even though it works, I don't want to use this attribute to hide columns on a grid bound to a business object if it's not indeed the correct usage of the attribute, but rather something some grid vendors decided to use to determine property visibility on their grids.

    Read the article

  • HTML files browsable but PHP ones aren't

    - by Oliver Nourish
    Hello I'm checking the ftp settings a client has sent me. I can create, edit and upload/download .html files fine. However I'm finding that .php files aren't brows-able, unless I don't use php tags. I know very little about the clients server at this point, but I have checked for a .htaccess file and not found one. What else can I do to determine if php is supported? This seems to be resolved.

    Read the article

  • User controls Stopped working after Migration from 3.7 to 5.2

    - by user1400290
    I recently Migrated my 3.7 sp4 project to 5.2, but I had issues while doing so. Currently, my user controls are not working after migration in 5.2 project. Below is the code: User Control Code: <%@ Control Language="C#" AutoEventWireup="true" CodeFile="SiteMenu.ascx.cs" Inherits="UserControls_Nav_SiteMenu" %> <%@ Register TagPrefix="telerik" Assembly="Telerik.Web.UI" Namespace="Telerik.Web.UI" %> <asp:SiteMapDataSource ID="SiteMapDataSource1" runat="server" ShowStartingNode="false" /> <telerik:RadMenu ID="RadMenu1" runat="server" DataSourceID="SitemapDataSource1" OnItemDataBound="RadMenu1_ItemDataBound"> </telerik:RadMenu> User Control's Class code: using System; using System.Data; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using System.ComponentModel; using System.Drawing; using Telerik; using Telerik.Cms; using Telerik.Cms.Web; using Telerik.Web.UI; using Telerik.Caching; using Telerik.Cms.Web.UI; [DefaultProperty("StartingNodeOffset")] public partial class UserControls_Nav_SiteMenu : System.Web.UI.UserControl, ICacheableObject { protected void Page_Load(object sender, EventArgs e) { } protected override void Render(HtmlTextWriter writer) { // Checks if this is called by the Search Indexer and does not render anything if so. // Navigation controls are present in every page and should NOT be indexed multiple times. if (!CmsContext.IsRequestCrawler(this.Context)) base.Render(writer); } #region Data Fields private bool hideUrlForGroupPages = false; private string selectedItemCssClass = "selectedItem"; #endregion #region Properties [Browsable(true)] [Category("Behavior")] public int LastExpandLevel { get { if (this.RadMenu1.MaxDataBindDepth < 0) return 0; return this.RadMenu1.MaxDataBindDepth; } set { if (value == 0) this.RadMenu1.MaxDataBindDepth = -1; else this.RadMenu1.MaxDataBindDepth = value; } } [Browsable(true)] [Category("Behavior")] public int ExpandDelay { get { return this.RadMenu1.ExpandDelay; } set { this.RadMenu1.ExpandDelay = value; } } [Browsable(true)] [Category("Behavior")] public bool ClickToOpen { get { return this.RadMenu1.ClickToOpen; } set { this.RadMenu1.ClickToOpen = value; } } [Browsable(true)] [Category("Behavior")] [DefaultValue(false)] public bool HideUrlForGroupPages { get { return this.hideUrlForGroupPages; } set { this.hideUrlForGroupPages = value; } } [Browsable(true)] [Category("Appearance")] public string SelectedItemCssClass { get { return this.selectedItemCssClass; } set { this.selectedItemCssClass = value; } } [Browsable(true)] [Category("Appearance")] public string CssClass { get { return this.RadMenu1.CssClass; } set { this.RadMenu1.CssClass = value; } } [Browsable(true)] public RadMenu Menu { get { return this.RadMenu1; } set { this.RadMenu1 = value; } } [Browsable(true)] [Category("Navigation")] public int StartingNodeOffset { get { return this.SiteMapDataSource1.StartingNodeOffset; } set { this.SiteMapDataSource1.StartingNodeOffset = value; } } [WebEditor("Telerik.Cms.Web.UI.UrlEditorWrapper, Telerik.Cms")] [Browsable(true)] [Category("Navigation")] public string StartingNodeUrl { get { return this.SiteMapDataSource1.StartingNodeUrl; } set { this.SiteMapDataSource1.StartingNodeUrl = value; } } [Browsable(true)] [Category("Navigation")] public bool StartFromCurrentNode { get { return this.SiteMapDataSource1.StartFromCurrentNode; } set { this.SiteMapDataSource1.StartFromCurrentNode = value; } } [Browsable(true)] [Category("Navigation")] public bool ShowStartingNode { get { return this.SiteMapDataSource1.ShowStartingNode; } set { this.SiteMapDataSource1.ShowStartingNode = value; } } /// <summary>(Exposed from contained RadMenu.)</summary> [Browsable(true)] [Category("Appearance")] public string SkinID { get { return this.RadMenu1.SkinID; } set { this.RadMenu1.SkinID = value; } } [Browsable(true)] [Category("Appearance")] public string Skin { get { return this.RadMenu1.Skin; } set { this.RadMenu1.Skin = value; } } #endregion #region Methods public void RadMenu1_ItemDataBound(object sender, RadMenuEventArgs e) { CmsSiteMapNode node = e.Item.DataItem as CmsSiteMapNode; if (this.hideUrlForGroupPages) { if (node != null) { // save the PageID in the attributes of the menu item e.Item.Attributes.Add("PageID", node.Key); if (node.PageType == CmsPageType.Group) { e.Item.NavigateUrl = ""; } } } if (node.CmsPage != null) { if (node.CmsPage.PageType == CmsPageType.External) { e.Item.Target = "_blank"; } } } #endregion #region ICacheableObject Members public System.Web.Caching.CacheDependency[] GetDependencies() { CmsSiteMapProvider provider = null; if (!String.IsNullOrEmpty(this.SiteMapDataSource1.SiteMapProvider)) provider = SiteMap.Providers[this.SiteMapDataSource1.SiteMapProvider] as CmsSiteMapProvider; else provider = SiteMap.Provider as CmsSiteMapProvider; if (provider != null) { return new System.Web.Caching.CacheDependency[]{ provider.CloneCacheDependency()}; } return null; } #endregion } When I edit the Template(in Admin mode), the following error is displayed in control location: Both DataSource and DataSourceID are defined on 'RadMenu1'. Remove one definition. 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.InvalidOperationException: Both DataSource and DataSourceID are defined on 'RadMenu1'. Remove one definition. 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: Both DataSource and DataSourceID are defined on 'RadMenu1'. Remove one definition.] System.Web.UI.WebControls.DataBoundControl.ConnectToDataSourceView() +3234866 System.Web.UI.WebControls.DataBoundControl.OnLoad(EventArgs e) +28 System.Web.UI.Control.LoadRecursive() +71 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.LoadRecursive() +190 System.Web.UI.Control.AddedControl(Control control, Int32 index) +11422584 System.Web.UI.Control.EnsureChildControls() +182 System.Web.UI.Control.PreRenderRecursiveInternal() +60 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Control.PreRenderRecursiveInternal() +222 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +4201 Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.0.30319.272 but I searched in my code as you can see above there's only DataSourceID is defined. What should I do? Thanks

    Read the article

  • Samba smb.conf read only and read/write accounts

    - by Pieter
    Below you can see my smb.conf, pieter is my admin user read/write on the shares works good with that account. Then I have a leecher account that has been added with smbpasswd -a leecher to the smb users, it is set up so this user only has read access to the shares. This works on MegaSam and on Thumbnails but not on my other drives, leecher does not get any access on the other shares. [global] security = user [MegaSam] comment = MegaSam path = /media/MegaSam browsable = yes guest ok = no read list = leecher write list = pieter create mask = 0755 [SilentBob] comment = SilentBob path = /media/SilentBob browsable = yes guest ok = no read list = leecher write list = pieter create mask = 0755 [Thumbnails] comment = Thumbnails path = /media/Thumbnails browsable = yes guest ok = no read list = leecher write list = pieter create mask = 0755 [Downloads] comment = Downloads path = /media/Downloads browsable = yes guest ok = no read list = leecher write list = pieter create mask = 0755

    Read the article

  • Projects with browsable source using dependency injection w/ guice?

    - by André
    I often read about dependency injection and I did research on google and I understand in theory what it can do and how it works, but I'd like to see an actual code base using it (Java/guice would be preferred). Can anyone point me to an open source project, where I can see, how it's really used? I think browsing the code and seeing the whole setup shows me more than the ususal snippets in the introduction articles you find around the web. Thanks in advance!

    Read the article

  • Use of metadatatype in linq-to-sql

    - by jess
    Hi, I had asked this question http://stackoverflow.com/questions/2442149/adding-more-attributes-to-linq-to-sql-entity Now, when I add Browsable attribute to generated entity in designer,it works.But,when I use the MetaDataType approach,and add Browsable attribute in partial class,it does not work "I added a MetaDataType class, and added browsable attribute to property,but seems to have no effect"

    Read the article

  • winUserControl in VS2010 - properties are not visible in designer

    - by mj82
    I have a problem with (I suppose) my Visual Studio 2010 Express environment: when I design my own UserControl, in Properties grid I can't see public properties of that control. They are however visible in the project, that reference this control. As it's Express Edition, I create new empty project, then add new UserControl to it. Then, for a test, I put following code: using System; using System.Collections.Generic; using System.ComponentModel; using System.Drawing; using System.Data; using System.Linq; using System.Text; using System.Windows.Forms; namespace Project1 { public partial class UserControl1 : UserControl { private int myNumber; [Browsable(true)] public int MyNumber { get { return myNumber; } set { myNumber = value; } } public UserControl1() { InitializeComponent(); } } } In VS 2008, as I remember, that should be enogh to show MyNumber property in Properties grid, even without [Browsable(true)] attribute. In VS 2010 however, when I double click UserControl1.cs in Solution Explorer and look in Properties, I don't see MyNumber. When I reference and use this control in another project, there is an access to it's properties. I've tried to competly reinstall VS 2010 environment, including SP1, but with no success. Do you have any idea what can be wrong? By the way: none of these attributes are working, either: [Browsable(true)] [EditorBrowsable(EditorBrowsableState.Always)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] [Bindable(true)] Best regards, Marcin

    Read the article

  • ASP.NET List Control

    - by Ricardo Peres
    Today I developed a simple control for generating lists in ASP.NET, something that the base class library does not contain; it allows for nested lists where the list item types and images can be configured on a list by list basis. Since it was a great fun to develop, I'd like to share it here. Here is the code: [ParseChildren(true)] [PersistChildren(false)] public class List: WebControl { public List(): base("ul") { this.Items = new List(); this.ListStyleType = ListStyleType.Auto; this.ListStyleImageUrl = String.Empty; this.CommonCssClass = String.Empty; this.ContainerCssClass = String.Empty; } [DefaultValue(ListStyleType.Auto)] public ListStyleType ListStyleType { get; set; } [DefaultValue("")] [UrlProperty("*.png;*.gif;*.jpg")] public String ListStyleImageUrl { get; set; } [DefaultValue("")] [CssClassProperty] public String CommonCssClass { get; set; } [DefaultValue("")] [CssClassProperty] public String ContainerCssClass { get; set; } [Browsable(false)] [PersistenceModeAttribute(PersistenceMode.InnerProperty)] public List Items { private set; get; } protected override void Render(HtmlTextWriter writer) { String cssClass = String.Join(" ", new String [] { this.CssClass, this.ContainerCssClass }); if (cssClass.Trim().Length != 0) { this.CssClass = cssClass; } if (String.IsNullOrEmpty(this.ListStyleImageUrl) == false) { this.Style[ HtmlTextWriterStyle.ListStyleImage ] = String.Format("url('{0}')", this.ResolveClientUrl(this.ListStyleImageUrl)); } if (this.ListStyleType != ListStyleType.Auto) { switch (this.ListStyleType) { case ListStyleType.Circle: case ListStyleType.Decimal: case ListStyleType.Disc: case ListStyleType.None: case ListStyleType.Square: this.Style [ HtmlTextWriterStyle.ListStyleType ] = this.ListStyleType.ToString().ToLower(); break; case ListStyleType.LowerAlpha: this.Style [ HtmlTextWriterStyle.ListStyleType ] = "lower-alpha"; break; case ListStyleType.LowerRoman: this.Style [ HtmlTextWriterStyle.ListStyleType ] = "lower-roman"; break; case ListStyleType.UpperAlpha: this.Style [ HtmlTextWriterStyle.ListStyleType ] = "upper-alpha"; break; case ListStyleType.UpperRoman: this.Style [ HtmlTextWriterStyle.ListStyleType ] = "upper-roman"; break; } } base.Render(writer); } protected override void RenderChildren(HtmlTextWriter writer) { foreach (ListItem item in this.Items) { this.writeItem(item, this, 0); } base.RenderChildren(writer); } private void writeItem(ListItem item, Control control, Int32 depth) { HtmlGenericControl li = new HtmlGenericControl("li"); control.Controls.Add(li); if (String.IsNullOrEmpty(this.CommonCssClass) == false) { String cssClass = String.Join(" ", new String [] { this.CommonCssClass, this.CommonCssClass + depth }); li.Attributes [ "class" ] = cssClass; } foreach (String key in item.Attributes.Keys) { li.Attributes[key] = item.Attributes [ key ]; } li.InnerText = item.Text; if (item.ChildItems.Count != 0) { HtmlGenericControl ul = new HtmlGenericControl("ul"); li.Controls.Add(ul); if (String.IsNullOrEmpty(this.ContainerCssClass) == false) { ul.Attributes["class"] = this.ContainerCssClass; } if ((item.ListStyleType != ListStyleType.Auto) || (String.IsNullOrEmpty(item.ListStyleImageUrl) == false)) { if (String.IsNullOrEmpty(item.ListStyleImageUrl) == false) { ul.Style[HtmlTextWriterStyle.ListStyleImage] = String.Format("url('{0}');", this.ResolveClientUrl(item.ListStyleImageUrl)); } if (item.ListStyleType != ListStyleType.Auto) { switch (this.ListStyleType) { case ListStyleType.Circle: case ListStyleType.Decimal: case ListStyleType.Disc: case ListStyleType.None: case ListStyleType.Square: ul.Style[ HtmlTextWriterStyle.ListStyleType ] = item.ListStyleType.ToString().ToLower(); break; case ListStyleType.LowerAlpha: ul.Style [ HtmlTextWriterStyle.ListStyleType ] = "lower-alpha"; break; case ListStyleType.LowerRoman: ul.Style [ HtmlTextWriterStyle.ListStyleType ] = "lower-roman"; break; case ListStyleType.UpperAlpha: ul.Style [ HtmlTextWriterStyle.ListStyleType ] = "upper-alpha"; break; case ListStyleType.UpperRoman: ul.Style [ HtmlTextWriterStyle.ListStyleType ] = "upper-roman"; break; } } } foreach (ListItem childItem in item.ChildItems) { this.writeItem(childItem, ul, depth + 1); } } } } [Serializable] [ParseChildren(true, "ChildItems")] public class ListItem: IAttributeAccessor { public ListItem() { this.ChildItems = new List(); this.Attributes = new Dictionary(); this.Text = String.Empty; this.Value = String.Empty; this.ListStyleType = ListStyleType.Auto; this.ListStyleImageUrl = String.Empty; } [DefaultValue(ListStyleType.Auto)] public ListStyleType ListStyleType { get; set; } [DefaultValue("")] [UrlProperty("*.png;*.gif;*.jpg")] public String ListStyleImageUrl { get; set; } [DefaultValue("")] public String Text { get; set; } [DefaultValue("")] public String Value { get; set; } [Browsable(false)] public List ChildItems { get; private set; } [Browsable(false)] public Dictionary Attributes { get; private set; } String IAttributeAccessor.GetAttribute(String key) { return (this.Attributes [ key ]); } void IAttributeAccessor.SetAttribute(String key, String value) { this.Attributes [ key ] = value; } } [Serializable] public enum ListStyleType { Auto = 0, Disc, Circle, Square, Decimal, LowerRoman, UpperRoman, LowerAlpha, UpperAlpha, None } SyntaxHighlighter.config.clipboardSwf = 'http://alexgorbatchev.com/pub/sh/2.0.320/scripts/clipboard.swf'; SyntaxHighlighter.brushes.CSharp.aliases = ['c#', 'c-sharp', 'csharp']; SyntaxHighlighter.all();

    Read the article

  • Text property in a UserControl in C#

    - by yeyeyerman
    I have a control with a inner TextBox. I want to make a direct relationship between the Text property of the UserControl and the Text property of the TextBox. The first thing I realized is that Text was not being displayed in the Properties of the UserControl. Then I added the Browsable(true) attribute. [Browsable(true)] public override string Text { get { return m_textBox.Text; } set { m_textBox.Text = value; } } Now, the text will be shown for a while, but then is deleted. This is because the information is not written within the xxxx.Designer.cs. How can this behviour be changed?

    Read the article

  • ASP.NET Creating a Rich Repeater, DataBind wiping out custom added controls...

    - by tonyellard
    So...I had this clever idea that I'd create my own Repeater control that implements paging and sorting by inheriting from Repeater and extending it's capabilities. I found some information and bits and pieces on how to go about this and everything seemed ok... I created a WebControlLibrary to house my custom controls. Along with the enriched repeater, I created a composite control that would act as the "pager bar", having forward, back and page selection. My pager bar works 100% on it's own, properly firing a paged changed event when the user interacts with it. The rich repeater databinds without issue, but when the databind fires (when I call base.databind()), the control collection is cleared out and my pager bars are removed. This screws up the viewstate for the pager bars making them unable to fire their events properly or maintain their state. I've tried adding the controls back to the collection after base.databind() fires, but that doesn't solve the issue. I start to get very strange results including problems with altering the hierarchy of the control tree (resolved by adding [ViewStateModeById]). Before I go back to the drawing board and create a second composite control which contains a repeater and the pager bars (so that the repeater isn't responsible for the pager bars viewstate) are there any thoughts about how to resolve the issue? In the interest of share and share alike, the code for the repeater itself is below, the pagerbars aren't as significant as the issue is really the maintaining of state for any additional child controls. (forgive the roughness of some of the code...it's still a work in progress) using System; using System.Collections.Generic; using System.ComponentModel; using System.Text; using System.Data; using System.Web; using System.Web.UI; using System.Web.UI.WebControls; [ViewStateModeById] public class SortablePagedRepeater : Repeater, INamingContainer { private SuperRepeaterPagerBar topBar = new SuperRepeaterPagerBar(); private SuperRepeaterPagerBar btmBar = new SuperRepeaterPagerBar(); protected override void OnInit(EventArgs e) { Page.RegisterRequiresControlState(this); InitializeControls(); base.OnInit(e); EnsureChildControls(); } protected void InitializeControls() { topBar.ID = this.ID + "__topPagerBar"; topBar.NumberOfPages = this._currentProperties.numOfPages; topBar.CurrentPage = this.CurrentPageNumber; topBar.PageChanged += new SuperRepeaterPagerBar.PageChangedEventHandler(PageChanged); btmBar.ID = this.ID + "__btmPagerBar"; btmBar.NumberOfPages = this._currentProperties.numOfPages; btmBar.CurrentPage = this.CurrentPageNumber; btmBar.PageChanged += new SuperRepeaterPagerBar.PageChangedEventHandler(PageChanged); } protected override void CreateChildControls() { EnsureDataBound(); this.Controls.Add(topBar); this.Controls.Add(btmBar); //base.CreateChildControls(); } private void PageChanged(object sender, int newPage) { this.CurrentPageNumber = newPage; } public override void DataBind() { //pageDataSource(); //DataBind removes all controls from control collection... base.DataBind(); Controls.Add(topBar); Controls.Add(btmBar); } private void pageDataSource() { //Create paged data source PagedDataSource pds = new PagedDataSource(); pds.PageSize = this.ItemsPerPage; pds.AllowPaging = true; // first get a PagedDataSource going and perform sort if possible... if (base.DataSource is System.Collections.IEnumerable) { pds.DataSource = (System.Collections.IEnumerable)base.DataSource; } else if (base.DataSource is System.Data.DataView) { DataView data = (DataView)DataSource; if (this.SortBy != null && data.Table.Columns.Contains(this.SortBy)) { data.Sort = this.SortBy; } pds.DataSource = data.Table.Rows; } else if (base.DataSource is System.Data.DataTable) { DataTable data = (DataTable)DataSource; if (this.SortBy != null && data.Columns.Contains(this.SortBy)) { data.DefaultView.Sort = this.SortBy; } pds.DataSource = data.DefaultView; } else if (base.DataSource is System.Data.DataSet) { DataSet data = (DataSet)DataSource; if (base.DataMember != null && data.Tables.Contains(base.DataMember)) { if (this.SortBy != null && data.Tables[base.DataMember].Columns.Contains(this.SortBy)) { data.Tables[base.DataMember].DefaultView.Sort = this.SortBy; } pds.DataSource = data.Tables[base.DataMember].DefaultView; } else if (data.Tables.Count > 0) { if (this.SortBy != null && data.Tables[0].Columns.Contains(this.SortBy)) { data.Tables[0].DefaultView.Sort = this.SortBy; } pds.DataSource = data.Tables[0].DefaultView; } else { throw new Exception("DataSet doesn't have any tables."); } } else if (base.DataSource == null) { // don't do anything? } else { throw new Exception("DataSource must be of type System.Collections.IEnumerable. The DataSource you provided is of type " + base.DataSource.GetType().ToString()); } if (pds != null && base.DataSource != null) { //Make sure that the page doesn't exceed the maximum number of pages //available if (this.CurrentPageNumber >= pds.PageCount) { this.CurrentPageNumber = pds.PageCount - 1; } //Set up paging values... btmBar.CurrentPage = topBar.CurrentPage = pds.CurrentPageIndex = this.CurrentPageNumber; this._currentProperties.numOfPages = btmBar.NumberOfPages = topBar.NumberOfPages = pds.PageCount; base.DataSource = pds; } } public override object DataSource { get { return base.DataSource; } set { //init(); //reset paging/sorting values since we've potentially changed data sources. base.DataSource = value; pageDataSource(); } } protected override void Render(HtmlTextWriter writer) { topBar.RenderControl(writer); base.Render(writer); btmBar.RenderControl(writer); } [Serializable] protected struct CurrentProperties { public int pageNum; public int itemsPerPage; public int numOfPages; public string sortBy; public bool sortDir; } protected CurrentProperties _currentProperties = new CurrentProperties(); protected override object SaveControlState() { return this._currentProperties; } protected override void LoadControlState(object savedState) { this._currentProperties = (CurrentProperties)savedState; } [Category("Status")] [Browsable(true)] [NotifyParentProperty(true)] [DefaultValue("")] [Localizable(false)] public string SortBy { get { return this._currentProperties.sortBy; } set { //If sorting by the same column, swap the sort direction. if (this._currentProperties.sortBy == value) { this.SortAscending = !this.SortAscending; } else { this.SortAscending = true; } this._currentProperties.sortBy = value; } } [Category("Status")] [Browsable(true)] [NotifyParentProperty(true)] [DefaultValue(true)] [Localizable(false)] public bool SortAscending { get { return this._currentProperties.sortDir; } set { this._currentProperties.sortDir = value; } } [Category("Status")] [Browsable(true)] [NotifyParentProperty(true)] [DefaultValue(25)] [Localizable(false)] public int ItemsPerPage { get { return this._currentProperties.itemsPerPage; } set { this._currentProperties.itemsPerPage = value; } } [Category("Status")] [Browsable(true)] [NotifyParentProperty(true)] [DefaultValue(1)] [Localizable(false)] public int CurrentPageNumber { get { return this._currentProperties.pageNum; } set { this._currentProperties.pageNum = value; pageDataSource(); } } }

    Read the article

  • Two-way databinding of a custom templated control. Eval works, but not Bind.

    - by Jason
    I hate long code snippets and I'm sorry about this one, but it turns out that this asp.net stuff can't get much shorter and it's so specific that I haven't been able to generalize it without a full code listing. I just want simple two-way, declarative databinding to a single instance of an object. Not a list of objects of a type with a bunch of NotImplementedExceptions for Add, Delete, and Select, but just a single view-state persisted object. This is certainly something that can be done but I've struggled with an implementation for years. This newest, closest implementation was inspired by this article from 4-Guys-From-Rolla, http://msdn.microsoft.com/en-us/library/aa478964.aspx. Unfortunately, after implementing, I'm getting the following error and I don't know what I'm missing: System.InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. If I don't use Bind(), and only use Eval() functionality, it works. In that way, the error is especially confusing. Here's the simplified codeset that still produces the error: using System.ComponentModel; namespace System.Web.UI.WebControls.Special { public class SampleFormData { public string SampleString = "Sample String Data"; public int SampleInt = -1; } [ToolboxItem(false)] public class SampleSpecificFormDataContainer : WebControl, INamingContainer { SampleSpecificEntryForm entryForm; internal SampleSpecificEntryForm EntryForm { get { return entryForm; } } [Bindable(true), Category("Data")] public string SampleString { get { return entryForm.FormData.SampleString; } set { entryForm.FormData.SampleString = value; } } [Bindable(true), Category("Data")] public int SampleInt { get { return entryForm.FormData.SampleInt; } set { entryForm.FormData.SampleInt = value; } } internal SampleSpecificFormDataContainer(SampleSpecificEntryForm entryForm) { this.entryForm = entryForm; } } public class SampleSpecificEntryForm : WebControl, INamingContainer { #region Template private IBindableTemplate formTemplate = null; [Browsable(false), DefaultValue(null), TemplateContainer(typeof(SampleSpecificFormDataContainer), ComponentModel.BindingDirection.TwoWay), PersistenceMode(PersistenceMode.InnerProperty)] public virtual IBindableTemplate FormTemplate { get { return formTemplate; } set { formTemplate = value; } } #endregion #region Viewstate SampleFormData FormDataVS { get { return (ViewState["FormData"] as SampleFormData) ?? new SampleFormData(); } set { ViewState["FormData"] = value; SaveViewState(); } } #endregion public override ControlCollection Controls { get { EnsureChildControls(); return base.Controls; } } private SampleSpecificFormDataContainer formDataContainer = null; [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public SampleSpecificFormDataContainer FormDataContainer { get { EnsureChildControls(); return formDataContainer; } } [Bindable(true), Browsable(false)] public SampleFormData FormData { get { return FormDataVS; } set { FormDataVS = value; } } protected override void CreateChildControls() { if (!this.ChildControlsCreated) { Controls.Clear(); formDataContainer = new SampleSpecificFormDataContainer(this); Controls.Add(formDataContainer); FormTemplate.InstantiateIn(formDataContainer); this.ChildControlsCreated = true; } } public override void DataBind() { CreateChildControls(); base.DataBind(); } } } With an ASP.NET page the following: <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="EntryFormTest._Default2" EnableEventValidation="false" %> <%@ Register Assembly="EntryForm" Namespace="System.Web.UI.WebControls.Special" TagPrefix="cc1" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to ASP.NET! </h2> <cc1:SampleSpecificEntryForm ID="EntryForm1" runat="server"> <FormTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("SampleString") %>'></asp:TextBox><br /> <h3>(<%# Container.SampleString %>)</h3><br /> <asp:Button ID="Button1" runat="server" Text="Button" /> </FormTemplate> </cc1:SampleSpecificEntryForm> </asp:Content> Default2.aspx.cs using System; namespace EntryFormTest { public partial class _Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { EntryForm1.DataBind(); } } } Thanks for any help!

    Read the article

  • Expose NativeActivity Variables to Workflow Designer

    - by sixlettervariables
    I've got a NativeActivity which contains an Activity body. The purpose of this activity is to expose a resource for the duration of the child activity as a Variable. The problem I've encountered is it appears the Variable cannot be used outside the activity. I'll use StreamReader as an example resource. ResourceActivity.cs: [Designer(typeof(ResourceActivityDesigner))] public sealed class ResourceActivity : NativeActivity { [RequiredArgument] public InArgument<string> Path { get; set; } [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] public Activity Body { get; set; } [Browsable(false), EditorBrowsable(EditorBrowsableState.Never)] public Variable<StreamReader> Resource { get; set; } public ResourceActivity() { this.Resource = new Variable<StreamReader> { Default = null, Name = "reader" }; } protected override void CacheMetadata(NativeActivityMetadata metadata) { if (this.Path != null) metadata.AddArgument(this.Path); if (this.Body != null) metadata.AddChild(this.Body); if (this.Resource != null) metadata.AddVariable(this.Resource); } protected override void Execute(NativeActivityContext context) { this.Resource.Set(context, new StreamReader(this.Path.Get(context))); context.ScheduleActivity(this.Body, new completionCallback(Done), new FaultCallback(Faulted)); } private void Done(NativeActivityContext context, ActivityInstance instance) { var reader = this.Reader.Get(context); if (reader != null) reader.Dispose(); } private void Faulted(NativeActivityFaultContext context, Exception ex, ActivityInstance instance) { var reader = this.Reader.Get(context); if (reader != null) reader.Dispose(); } } I cannot view "Resource" or "reader" in the Variables list in the Workflow Designer. Am I missing something in CacheMetadata?

    Read the article

  • WF -- how do I use a custom activity without creating it in a separate Workflow Activity Library?

    - by Kevin Craft
    I am trying to accomplish something that seems like it should be very simple. I have a State Machine Workflow Console Application with a workflow in it. I have created a custom activity for it. This activity will NEVER be used ANYWHERE ELSE. I just want to use this activity on my workflow, but: It does not appear in the toolbox. I cannot drag it from the Solution Explorer onto the workflow designer. I absolutely do not want to create a separate State Machine Workflow Activity Library, since that will just clutter my solution. Like I said, I will never use this activity in any other project, so I would like to keep it confined to this one...but I just can't figure out how to get it onto the designer! Am I going crazy!? Here is the code for the activity: public partial class GameSearchActivity: Activity { public GameSearchActivity() { InitializeComponent(); } public static DependencyProperty QueryProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Query", typeof(string), typeof(GameSearchActivity)); [Description("Query")] [Category("Dependency Properties")] [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public string Query { get { return ((string)(base.GetValue(GameSearchActivity.QueryProperty))); } set { base.SetValue(GameSearchActivity.QueryProperty, value); } } public static DependencyProperty ResultsProperty = System.Workflow.ComponentModel.DependencyProperty.Register("Results", typeof(string), typeof(GameSearchActivity)); [Description("Results")] [Category("Dependency Properties")] [Browsable(true)] [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] public IEnumerable<Game_GamePlatform> Results { get { return ((IEnumerable<Game_GamePlatform>)(base.GetValue(GameSearchActivity.ResultsProperty))); } set { base.SetValue(GameSearchActivity.ResultsProperty, value); } } protected override ActivityExecutionStatus Execute(ActivityExecutionContext executionContext) { IDataService ds = executionContext.GetService<IDataService>(); Results = ds.SearchGames(Query); return ActivityExecutionStatus.Closed; } } Thanks. EDIT: OK, so I've discovered that if I change the project type from Console Application to Class Library, the custom activity appears in the toolbox. However, this is not acceptable. It needs to be a Console/Windows Application. Anyone know a way around this?

    Read the article

  • Google Indexed an Unlinked Page

    - by Yar
    Google indexed a page on a site of mine that was not linked from any other page, ever. No one has ever put a link to it, and the directory contents were not browsable. How could this happen? I thought crawlers have no way to include a page that is not linked.

    Read the article

  • How to protect files/folders from being copied/moved/deleted/cut on windows

    - by Sean Lee
    I need to share data on an external drive that will be handed over to someone else, and I would like to achieve the following: (1) protect all the files and folders from being copied/moved/deleted/cut on windows system (2) files are browsable and media playable, but it stays inside the drive (3) the same behavior if drive is plugged on linux system, or not accessible at all is fine too. How can I do these without using paid software?

    Read the article

  • Two-way databinding of a custom templated asp.net control

    - by Jason
    I hate long code snippets and I'm sorry about this one, but it turns out that this asp.net stuff can't get much shorter and it's so specific that I haven't been able to generalize it without a full code listing. I just want simple two-way, declarative, edit-only databinding to a single instance of an object. Not a list of objects of a type with a bunch of NotImplementedExceptions for Add, Delete, and Select, but just a single view-state persisted object. This is certainly something that can be done but I've struggled with an implementation for years. This newest, closest implementation was inspired by this article from 4-Guys-From-Rolla. Unfortunately, after implementing, I'm getting the following error and I don't know what I'm missing: System.InvalidOperationException: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. If I don't use Bind(), and only use Eval() functionality, it works. In that way, the error is especially confusing. Update: Actually, using Eval() does NOT work, but using <%# Container.SampleString %> works. However, Eval("SampleString") gives the same error. That leads me back to this article I found earlier but had discarded. Now I believe it might be related, though I haven't cracked it yet ... Here's the simplified codeset that still produces the error: using System.ComponentModel; namespace System.Web.UI.WebControls.Special { public class SampleFormData { public string SampleString = "Sample String Data"; public int SampleInt = -1; } [ToolboxItem(false)] public class SampleSpecificFormDataContainer : DataBoundControl, INamingContainer { SampleSpecificEntryForm entryForm; internal SampleSpecificEntryForm EntryForm { get { return entryForm; } } [Bindable(true), Category("Data")] public string SampleString { get { return entryForm.FormData.SampleString; } set { entryForm.FormData.SampleString = value; } } [Bindable(true), Category("Data")] public int SampleInt { get { return entryForm.FormData.SampleInt; } set { entryForm.FormData.SampleInt = value; } } internal SampleSpecificFormDataContainer(SampleSpecificEntryForm entryForm) { this.entryForm = entryForm; } } public class SampleSpecificEntryForm : WebControl, INamingContainer { #region Template private IBindableTemplate formTemplate = null; [Browsable(false), DefaultValue(null), TemplateContainer(typeof(SampleSpecificFormDataContainer), ComponentModel.BindingDirection.TwoWay), PersistenceMode(PersistenceMode.InnerProperty)] public virtual IBindableTemplate FormTemplate { get { return formTemplate; } set { formTemplate = value; } } #endregion #region Viewstate SampleFormData FormDataVS { get { return (ViewState["FormData"] as SampleFormData) ?? new SampleFormData(); } set { ViewState["FormData"] = value; SaveViewState(); } } #endregion public override ControlCollection Controls { get { EnsureChildControls(); return base.Controls; } } private SampleSpecificFormDataContainer formDataContainer = null; [Browsable(false), DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] public SampleSpecificFormDataContainer FormDataContainer { get { EnsureChildControls(); return formDataContainer; } } [Bindable(true), Browsable(false)] public SampleFormData FormData { get { return FormDataVS; } set { FormDataVS = value; } } protected override void CreateChildControls() { if (!this.ChildControlsCreated) { Controls.Clear(); formDataContainer = new SampleSpecificFormDataContainer(this); Controls.Add(formDataContainer); FormTemplate.InstantiateIn(formDataContainer); this.ChildControlsCreated = true; } } public override void DataBind() { CreateChildControls(); base.DataBind(); } } } With an ASP.NET page the following: <%@ Page Title="Home Page" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeBehind="Default2.aspx.cs" Inherits="EntryFormTest._Default2" EnableEventValidation="false" %> <%@ Register Assembly="EntryForm" Namespace="System.Web.UI.WebControls.Special" TagPrefix="cc1" %> <asp:Content ID="HeaderContent" runat="server" ContentPlaceHolderID="HeadContent"> </asp:Content> <asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Welcome to ASP.NET! </h2> <cc1:SampleSpecificEntryForm ID="EntryForm1" runat="server"> <FormTemplate> <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("SampleString") %>'></asp:TextBox><br /> <h3>(<%# Container.SampleString %>)</h3><br /> <asp:Button ID="Button1" runat="server" Text="Button" /> </FormTemplate> </cc1:SampleSpecificEntryForm> </asp:Content> Default2.aspx.cs using System; namespace EntryFormTest { public partial class _Default2 : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { EntryForm1.DataBind(); } } } Thanks for any help!

    Read the article

  • Can't recognize local webserver

    - by Syed Khalil-ur-Rehman
    My Internet Cable provider has set up a web server which hosts different entertainment material like movies, songs, tv shows and games etc. While using windows the pc recognises it as a local web server and downloads files with full LAN speed of 10 mb per second. On the contrary when using Ubuntu I am only able to download the files on my Internet speed not more than 100 kb per second. What ever I try ubuntu does not recognizes the webserver as a local area network web server but as a normal internet website. How to make Ubuntu download files from this server with full LAN speed. Please help in this regard. The url is http://dmasti.pk and yes it is a web server browsable by a web browser like firefox or ie.

    Read the article

  • How do I get write access to ubuntu files from Windows?

    - by Steven
    I'm running Ubuntu 11.10 on my Virtual Machine as a web server. I've mounted the W:/ drive in Win 7 to my /www folder in Ubuntu. I can read the files, but I'm not able to write to the files. In Samba, I have created the following user: <www-data> = "<www-data>" And given guest ok for the www folder: [www] comment = Ubuntu WWW area path = /var/www browsable = yes guest ok = yes read only = no create mask = 0755 ;directory mask = 0775 force user = www-data force group = www-data I've also run sudo chmod -R 755 www to make ensure correct rw access. What am I missing in order to get write access to my ubuntu files from Windows?

    Read the article

  • OAuth + Twitter on Android: Callback fails

    - by Samuh
    My Android application uses Java OAuth library, found here for authorization on Twitter. I am able to get a request token, authorize the token and get an acknowlegement but when the browser tries the call back url to reconnect with my application, it does not use the URL I provide in code, but uses the one I supplied while registering with Twitter. Note: 1. When registering my application with twitter, I provided a hypothetical call back url:http://abz.xyc.com and set the application type as browser. 2. I provided a callback url in my code "myapp" and have added an intent filter for my activity with Browsable category and data scheme as "myapp". 3. URL called when authorizing does contain te callback url, I specified in code. Any idea what I am doing wrong here? Relevant Code: public class FirstActivity extends Activity { /** Called when the activity is first created. */ @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); OAuthAccessor client = defaultClient(); Intent i = new Intent(Intent.ACTION_VIEW); i.setData(Uri.parse(client.consumer.serviceProvider.userAuthorizationURL + "?oauth_token=" + client.requestToken + "&oauth_callback=" + client.consumer.callbackURL)); startActivity(i); } OAuthServiceProvider defaultProvider() { return new OAuthServiceProvider(GeneralRuntimeConstants.request_token_URL, GeneralRuntimeConstants.authorize_url, GeneralRuntimeConstants.access_token_url); } OAuthAccessor defaultClient() { String callbackUrl = "myapp:///"; OAuthServiceProvider provider = defaultProvider(); OAuthConsumer consumer = new OAuthConsumer(callbackUrl, GeneralRuntimeConstants.consumer_key, GeneralRuntimeConstants.consumer_secret, provider); OAuthAccessor accessor = new OAuthAccessor(consumer); OAuthClient client = new OAuthClient(new HttpClient4()); try { client.getRequestToken(accessor); } catch (Exception e) { e.printStackTrace(); } return accessor; } @Override protected void onResume() { // TODO Auto-generated method stub super.onResume(); Uri uri = this.getIntent().getData(); if (uri != null) { String access_token = uri.getQueryParameter("oauth_token"); } } } // Manifest file <application android:icon="@drawable/icon" android:label="@string/app_name"> <activity android:name=".FirstActivity" android:label="@string/app_name"> <intent-filter> <action android:name="android.intent.action.MAIN" /> <category android:name="android.intent.category.LAUNCHER" /> </intent-filter> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="myapp"/> </intent-filter> </activity> </application>

    Read the article

  • AJAX Search like nerddinner.com

    - by Dan
    Hi, can somebody tell me how it's needed to change the nerdDinner project, that the 'location-search' which is an JSON-Based Ajax call, works like http://www.nerddinner.com/#where=london so that the search-location parameter will be added to the queryString and make the location browsable? Thanks a lot, dan

    Read the article

1 2 3 4  | Next Page >