Search Results

Search found 164 results on 7 pages for 'databound'.

Page 5/7 | < Previous Page | 1 2 3 4 5 6 7  | Next Page >

  • How can I set different Tooltip text for each item in a listbox?

    - by Michael Lang
    I have a listbox that is databound to a Collection of objects. The listbox is configured to display an identifier property of each object. I would like to show a tooltip with information specific to the item within the listbox that is being hovered over rather than one tooltip for the listbox as a whole. I am working within WinForms and thanks to some helpful blog posts put together a pretty nice solution, which I wanted to share. I'd be interested in seeing if there's any other elegant solutions to this problem, or how this may be done in WPF.

    Read the article

  • Switching to FormViewMode.Edit is very slow

    - by Tim
    When i switch an ASP.Net Formview from readonly mode to edit mode it takes more than 6 seconds(from edit to readonly takes a split second). I have no idea whats the reason for it. The EditItemTemplate contains a lot of controls(table,textboxes,dropdownlists) but in fact not more than the ItemTemplate has. Yet i have even commented out the complete FormView.DataBound where the controls are data bounded but without significant change. My ASP.Net Web Apllication is using Ajax and the Formview is completely nested in an UpdatePanel. Any suggestions or assumptions for this behaviour?

    Read the article

  • Unable to bind in asp.net grid Template Column

    - by OneSmartGuy
    I am having trouble accessing the data field. I receive the error: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. I can get the value but using <%# getOpenJobs((string)Eval("ParentPart")) % but I need to use it in the if to display a certian picture if it passes the condition. Is there a better way to do this or am i just missing something simple? <telerik:GridTemplateColumn UniqueName="hasOpenJobs" HeaderText=""> <ItemTemplate> <% if (getOpenJobs((string)Eval("ParentPart")) > 1) { %> <img src="../images/job-icon.gif" alt="Open Jobs" /> <%} %> </ItemTemplate> </telerik:GridTemplateColumn>

    Read the article

  • How to display a date time in 16 Nov 2011 15:12 format

    - by Mark
    I have a grid view column in which I give the datefomat as dd MMM yyyy HH:mm and in code behind databound I change the time, the same time in database is not shown in the gridview, because of that the date is not displayed in 16 Nov 2011 15:12 format, it is displayed in 16/11/2011 15:12 format, how can i display it in 16 Nov 2011 15:12 format asp <asp:BoundField DataField="SendDate" ItemStyle-Width="15%" HeaderText="Sent At" DataFormatString="{0:dd MMM yyyy HH:mm}" SortExpression="SendDate" /> c# double timeDifference = Convert.ToDouble(Session["utimezone"].ToString()); e.Row.Cells[5].Text = Convert.ToString(senddate.AddMinutes(timeDifference * 60));

    Read the article

  • Databinding a list (in an object) to a combobox in VB.net

    - by Casey
    VB 2008 .NET 3.5 I have a custom "Shipment" object that contains a list of "ShippingRate" objects. This list of "ShippingRates" is accessible through a property "Shipment.PossibleShippingRates." That property simply returns a copy of the list of "ShippingRate" for that particular Shipment. My UI layer receives a list of "Shipment" objects from the BLL. This list is databound to a datagridview, and shows details relevant to the Shipment such as Shipping Address, etc. I want to bind the "Shipment.PossibleShippingRates" property to a combobox, such that when the user changes the grid row, the combobox reflects the "PossibleShippingRates" for that "Shipment." In addition, I need a way to store the "ShippingRate" they selected from the combobox for later use. I have tried a few ideas, but none of them work properly. Any ideas on how to do this?

    Read the article

  • Why is this consider bad practice? or is it? (ASP.Net)

    - by user318573
    Would this code be considered bad practice: <div id="sidebar"> <% =DisplayMeetings(12) %> </div> This is a snippet of code from the default.aspx of a small web app I have worked on. It works perfectly well, runs very fast, but as always, I am aware of the fact that just because it works, doesn't mean it is OK. Basically, the DisplayMeetings subroutine outputs a bunch of formatted HTML (an unordered list actually), with no formatting, just the requisite html, and then my CSS performs all the necessary formatting. The data for generating the list comes from an SQL server database (the parameter controls how many rows to return) and I am using stored procedures and datareader for fast access. This keeps my front-end extraordinary simple and clean, imho, and lets me do all the work in VB or C# in a separate module. I could of course use a databound repeater (and probably 6 or more other methods) of accomplishing the same thing, but are they any better? Other than loosing the design-time features of VS2010?

    Read the article

  • SQL - Link to more table information

    - by BioXhazard
    I have a datagrid with 3 of 5 fields from a SQL table. The first databound was changed to an asp:hyperlink so the field can be clicked. What I want to do is, when the user clicks an object in the field, it sends the ID to another page. From there, it uses the request in order to display the required information which is found in the same SQL table. For example: User clicks on a cell in the first column, it brings them to a page with more information on that cell.

    Read the article

  • Using INotifyPropertyChanged in background threads

    - by digitaldias
    Following up on a previous blog post where I exemplify databinding to objects, a reader was having some trouble with getting the UI to update. Here’s the rough UI: The idea is, when pressing Start, a background worker process starts ticking at the specified interval, then proceeds to increment the databound Elapsed value. The problem is that event propagation is limeted to current thread, meaning, you fire an event in one thread, then other threads of the same application will not catch it. The Code behind So, somewhere in my ViewModel, I have a corresponding bethod Start that initiates a background worker, for example: public void Start( ) { BackgroundWorker backgroundWorker = new BackgroundWorker( ); backgroundWorker.DoWork += IncrementTimerValue; backgroundWorker.RunWorkerAsync( ); } protected void IncrementTimerValue( object sender, DoWorkEventArgs e ) { do { if( this.ElapsedMs == 100 ) this.ElapsedMs = 0; else this.ElapsedMs++; }while( true ); } Assuming that there is a property: public int ElapsedMs { get { return _elapsedMs; } set { if( _elapsedMs == value ) return; _elapsedMs = value; NotifyThatPropertyChanged( "ElapsedMs" ); } } The above code will not work. If you step into this code in debug, you will find that INotifyPropertyChanged is called, but it does so in a different thread, and thus the UI never catches it, and does not update. One solution Knowing that the background thread updates the ElapsedMs member gives me a chance to activate BackgroundWorker class’ progress reporting mechanism to simply alert the main thread that something has happened, and that it is probably a good idea to refresh the ElapsedMs binding. public void Start( ) { BackgroundWorker backgroundWorker = new BackgroundWorker( ); backgroundWorker.DoWork += IncrementTimerValue; // Listen for progress report events backgroundWorker.WorkerReportsProgress = true; // Tell the UI that ElapsedMs needs to update backgroundWorker.RunWorkerCompleted += ( sender, e ) => { NotifyThatPropertyChanged( "ElapsedMs" ) }; backgroundWorker.RunWorkerAsync( ); } protected void IncrementTimerValue( object sender, DoWorkEventArgs e ) { do { if( this.ElapsedMs == 100 ) this.ElapsedMs = 0; else this.ElapsedMs++; // report any progress ( sender as BackgroundWorker ).ReportProgress( 0 ); }while( true ); } What happens above now is that I’ve used the BackgroundWorker cross thread mechanism to alert me of when it is ok for the UI to update it’s ElapsedMs field. Because the property itself is being updated in a different thread, I’m removing the NotifyThatPropertyChanged call from it’s Set method, and moving that responsability to the anonymous method that I created in the Start method. This is one way of solving the issue of having a background thread update your UI. I would be happy to hear of other cross-threading mechanisms for working in a MCP/MVC/MVVM pattern.

    Read the article

  • Microsoft Word "Random" Crashes

    - by Bent Rasmussen
    Word seemingly randomly crashes in an application setting where it is first being used to programmatically databind (bookmarks) and then directly afterwards opened on the user machine for further user input. The error message is quite precise but the workaround has eluded me. Word crashes a moment or two after it has been opened on the user machine with the below exception details. Problem signature: Problem Event Name: APPCRASH Application Name: WINWORD.EXE Application Version: 14.0.6129.5000 Application Timestamp: 5082f354 Fault Module Name: wwlib.dll Fault Module Version: 14.0.6129.5000 Fault Module Timestamp: 5082f3dc Exception Code: c0000005 Exception Offset: 000eed32 OS Version: 6.1.7601.2.1.0.16.7 Locale ID: 1030 Additional information about the problem: LCID: 1030 skulcid: 1030 Sometimes one can run the exact same scenario 50 times before experiencing a crash, other times only a few times. We have tried using different versions of the Word format as well as renaming the databound file after saving so that the file being opened on the user machine is different. Principally Word should never crash but perhaps there is some workaround that can make Word not crash. Googling for a solution there appears to be multiple things that can trigger this bug.

    Read the article

  • Iterate over rows/checkboxes in a RadGrid

    - by ChessWhiz
    Hi, I have a Telerik RadGrid with a GridTemplateColumn that contains a checkbox, as follows: <telerik:GridTemplateColumn HeaderText="MINE" UniqueName="MyTemplateColumn"> <ItemTemplate> <asp:CheckBox id="MyCheckBox" runat="server"></asp:CheckBox> </ItemTemplate> </telerik:GridTemplateColumn> I want to set the box to be "checked" based on a value read from the database. I could handle the ItemDataBound event and read the database when each row is bound, but that results in n lookups. Instead, I want to handle DataBound, and then set all the values at once. So, in that method, I want code like this: // read all values from database first, then... foreach(var chkbox in MyRadGrid.MasterTableView.Columns.FindByUniqueName("MyTemplateColumn").FindControl("MyCheckBox")) { chkbox.Checked = oneValue; } That doesn't work, because FindControl isn't a method of GridColumn, and it won't generate an iterable list of the checkboxes. What is the correct way to iterate through the checkboxes in the template column? Thanks!

    Read the article

  • Databinding a multiselect ListBox in a FormView control

    - by drs9222
    I have a multiselect ListBox within a FormView. I can't figure out how to setup the databinding for it. I can populate the listbox fine. If the listbox was a single select I could use say SelectValue='<%#Bind("col")%>' and that works fine. Is there something that I can bind to for a multiselect listbox? I've tried manually DataBinding by handling the DataBinding event of the listbox and setting the selected property on the appropriate items. Unfortunately, there are no items in the listbox during the DataBinding event. The closest thing I've found is to save the value that determines what items should be selecting during DataBinding and then use that value in the FormViews DataBinding event to select the right items which seems like a hack to me. Is there a better way? EDIT: To clarify what I am currently doing... I am using the FormViews's ItemCreated event to save the FormView's DataItem. Then in the FormView's DataBound event I find the listbox and manually set the selected items. It doesn't seem right that I have to save the value like this and I assume there is a more correct way to do this that I just can't see.

    Read the article

  • ObservableCollection is not updating Multibinding in C# WPF

    - by Decept
    I have a TreeView that creates all its items from databound ObservableCollections. I have a hierarchy of GameNode objects, each object has two ObservableCollections. One collections has EntityAttrib objects and the other have GameNode objects. You could say that the GameNode object represents folders and EntityAttrib represents files. To display both attrib and GameNodes in the same TreeView I use Multibinding. This all works fine in startup, but when I add a new GameNode somewhere in the hierarchy the TreeView is not updated. I set a breakpoint in my converter method but it's not called when adding a new GameNode. It seems that the ObservableCollection is not notifying the MultiBinding of the change. If I comment out the MultiBinding and only bind the GameNode collection it works as expected. XAML: <HierarchicalDataTemplate DataType="{x:Type local:GameNode}"> <HierarchicalDataTemplate.ItemsSource> <MultiBinding Converter="{StaticResource combineConverter}"> <Binding Path="Attributes" /> <Binding Path="ChildNodes" /> </MultiBinding> </HierarchicalDataTemplate.ItemsSource> <TextBlock Text="{Binding Path=Name}" ContextMenu="{StaticResource EntityCtxMenu}"/> </HierarchicalDataTemplate> C#: public class GameNode { string mName; public string Name { get { return mName; } set { mName = value; } } GameNodeList mChildNodes = new GameNodeList(); public GameNodeList ChildNodes { get { return mChildNodes; } set { mChildNodes = value; } } ObservableCollection<EntityAttrib> mAttributes = new ObservableCollection<EntityAttrib>(); public ObservableCollection<EntityAttrib> Attributes { get { return mAttributes; } set { mAttributes = value; } } } GameNodeList is a subclassed ObservableCollection

    Read the article

  • Jquery Fancybox not working after postback

    - by Lee Englestone
    I have a Fancybox (or more accurately) a number of fancy boxes on an asp.net page. My Fancybox (jquery plugin) works fine until a postback occurs on the page then it refuses to work. Any thoughts? Anyone experienced similar behaviour? UPDATE : Some Code.. I have a databound repeater with a fancybox on each repeating item. They are instanciated by (outside the repeater) $(document).ready(function() { $("a.watchvideo").fancybox({ 'overlayShow': false, 'frameWidth' : 480, 'frameHeight' : 400 }); }); The anchor tag is repeated.. href="#watchvideo_<%#Eval("VideoId")%" As is a div with id="watchvideo_<%#Eval("VideoId") %> As is a script element that instanciates the flash movies Yes the VideoIds are being output the the page. UPDATE : It's not a problem with the flash.. It is not a problem with the flash as i've tried it without the flash, it wont even pop a window with a simple message in. UPDATE : I wonder if it is the updatepanel. http://stackoverflow.com/questions/301473/rebinding-events-in-jquery-after-ajax-update-updatepanel -- lee

    Read the article

  • Handle exceptions with WPF and MVVM

    - by Jon Cahill
    I am attempting to build an application using WPF and the MVVM pattern. I have my Views being populated from my ViewModel purely through databinding. I want to have a central place to handle all exceptions which occur in my application so I can notify the user and log the error appropriately. I know about Dispatcher.UnhandledException but this does not do the job as exception that occur during databinding are logged to the output windows. Because my View is databound to my ViewModel the entire application is pretty much controlled via databinding so I have no way to log my errors. Is there a way to generically handle the exceptions raised during databinding, without having to put try blocks around all my ViewModel public's? Example View: <Window x:Class="Test.TestView" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Title="TestView" Height="600" Width="800" WindowStartupLocation="CenterScreen"> <Window.Resources> <BooleanToVisibilityConverter x:Key="BooleanToVisibilityConverter" /> </Window.Resources> <StackPanel VerticalAlignment="Center"> <Label Visibility="{Binding DisplayLabel, Converter={StaticResource BooleanToVisibilityConverter}}">My Label</Label> </StackPanel> </Window> The ViewModel: public class TestViewModel { public bool DisplayLabel { get { throw new NotImplementedException(); } } } It is an internal application so I do not want to use Wer as I have seen previously recommended.

    Read the article

  • Binding a DropDownList in ListView InsertItemTemplate throwing an error

    - by Telos
    I've got a ListView which binds to a LinqDataSource and displays selected locations. The insert item Contains a dropdownlist that pulls from another LinqDataSource to give all the unselected locations. The problem is that I get the following error when loading the page: Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. I'm doing a very similar setup in another page of the website, and it isn't giving us this error so I'm pretty confused. I know I can work around this by not binding, manually finding the control and getting the value, but this should work and I don't understand why it isn't. Any thoughts? The better part of the source code is below. <asp:LinqDataSource ID="ldsLocations" runat="server" ContextTypeName="ClearviewInterface.ESLinqDataContext" EnableDelete="true" EnableInsert="true" OnInserting="ldsLocations_Inserting" OnDeleting="ldsLocations_Deleting" TableName="crmLocations" OrderBy="addr1" OnSelecting="ldsLocations_Selecting" /> <asp:LinqDataSource ID="ldsFreeLocations" runat="server" ContextTypeName="ClearviewInterface.ESLinqDataContext" OrderBy="addr1" TableName="v_CVLocations" OnSelecting="ldsFreeLocations_Selecting" /> <asp:ListView ID="lvLocations" DataSourceID="ldsLocations" DataKeyNames="ID" InsertItemPosition="LastItem" runat="server" > <InsertItemTemplate> <tr> <td colspan="6"><hr /></td> </tr> <tr> <td colspan="2"> <asp:DropDownList ID="ddlFreeLocations" DataSourceID="ldsFreeLocations" DataTextField="addr1" DataValueField="record" MarkFirstMatch="true" SelectedValue='<%# Bind("record") %>' runat="server" /> </td> <td><asp:ImageButton ID="btnAdd" CommandName="Insert" SkinID="Insert" runat="server" /></td> </tr> </InsertItemTemplate>

    Read the article

  • WPF Update Binding when Bound directly to DataContext w/ Converter

    - by Adam
    Normally when you want a databound control to 'update,' you use the "PropertyChanged" event to signal to the interface that the data has changed behind the scenes. For instance, you could have a textblock that is bound to the datacontext with a property "DisplayText" <TextBlock Text="{Binding Path=DisplayText}"/> From here, if the DataContext raises the PropertyChanged event with PropertyName "DisplayText," then this textblock's text should update (assuming you didn't change the Mode of the binding). However, I have a more complicated binding that uses many properties off of the datacontext to determine the final look and feel of the control. To accomplish this, I bind directly to the datacontext and use a converter. In this case I am working with an image source. <Image Source="{Binding Converter={StaticResource ImageConverter}}"/> As you can see, I use a {Binding} with no path to bind directly to the datacontext, and I use an ImageConverter to select the image I'm looking for. But now I have no way (that I know of) to tell that binding to update. I tried raising the propertychanged event with "." as the propertyname, which did not work. Is this possible? Do I have to wrap up the converting logic into a property that the binding can attach to, or is there a way to tell the binding to refresh (without explicitly refreshing the binding)? Any help would be greatly appreciated. Thanks! -Adam

    Read the article

  • How could I make this display for listbox?

    - by baron
    Hello everyone, I have a databound listbox which is actually displaying two columns of data. It is displayed as follows: <UserControl.Resources> <DataTemplate x:Key="AlignedPairs"> <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="*" /> <ColumnDefinition Width="Auto" /> <ColumnDefinition Width="10" /> <ColumnDefinition Width="*" /> </Grid.ColumnDefinitions> <TextBlock Text="{Binding Fruits}" Grid.Column="0" /> <TextBlock Text="->" TextAlignment="Center" Grid.Column="1" /> <TextBlock Text="{Binding Colors}" Grid.Column="3" /> </Grid> </DataTemplate> </UserControl.Resources> <ListBox Name="lbStuff" Grid.ColumnSpan="2" Grid.Row="1" ItemTemplate="{StaticResource AlignedPairs}"> <ListBox.ItemContainerStyle> <Style TargetType="ListBoxItem"> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> </Style> </ListBox.ItemContainerStyle> </ListBox> Then Itemsource set in codebehind. Based on some logic however, I would like to set either a line or a item in one of the columns, e.g. a fruit to red, or the line to bold. I have code to work out which Fruit or Color I would like to differentiate (by color/bold) in the code behind, but I can't figure out, especially given the custom listbox display, how I could go about setting a particular item to a different color/bold. Does anyone have any ideas? Let me know if any further code is required. Cheers.

    Read the article

  • How to set focus to a brand new TextBox which was created as a result of a databinding in WPF?

    - by Mike
    Hi everyone, I have a WPF ItemsControl that is bound to an ObservableCollection. The XAML: <ItemsControl Name="mItemsControl"> <ItemsControl.ItemTemplate> <DataTemplate> <TextBox Text="{Binding Mode=OneWay}"></TextBox> </DataTemplate> </ItemsControl.ItemTemplate> </ItemsControl> The codebehind: private ObservableCollection<string> mCollection = new ObservableCollection<string>(); public MainWindow() { InitializeComponent(); this.mCollection.Add("Test1"); this.mCollection.Add("Test2"); this.mItemsControl.ItemsSource = this.mCollection; } private void Button_Click(object sender, RoutedEventArgs e) { this.mCollection.Add("new item!"); } When I click a button, it adds a new string to the databound ObservableCollection which triggers a new TextBox to appear. I want to give this new textbox focus. I've tried this technique from a related StackOverflow question but it always sets focus to the textbox before the newly created one. private void Button_Click(object sender, RoutedEventArgs e) { this.mCollection.Add("new item!"); // MoveFocus takes a TraversalRequest as its argument. TraversalRequest request = new TraversalRequest(FocusNavigationDirection.Previous); // Gets the element with keyboard focus. UIElement elementWithFocus = Keyboard.FocusedElement as UIElement; // Change keyboard focus. if (elementWithFocus != null) { elementWithFocus.MoveFocus(request); } } My need seems simple enough, but it's almost like the new textbox doesn't really exist until a slight delay after something is added to the ObservableCollection. Any ideas of what would work? Thanks! -Mike

    Read the article

  • using eval in server side code on asp.net page

    - by Sumit Sharma
    <asp:Repeater ID="rptrParent" runat="server"> <ItemTemplate> <li> <a href="<% =ResolveUrl("~/cPanel/UserView.aspx?User=")%><%# Eval("StudentUserName") %>"> <span> <% ProfileCommon pc = new ProfileCommon(); pc.GetProfile(Eval("StudentUserName").ToString()); Response.Write(pc.FirstName + "" + pc.LastName); %> <%# Eval("StudentUserName") %> </span> </a> </li> </ItemTemplate> The following error Databinding methods such as Eval(), XPath(), and Bind() can only be used in the context of a databound control. is coming in this part <% ProfileCommon pc = new ProfileCommon(); pc.GetProfile(Eval("StudentUserName").ToString()); Response.Write(pc.FirstName + "" + pc.LastName); %>

    Read the article

  • ASP.NET RadioButton messing with the name (groupname)

    - by Hojou
    I got a templated control (a repeater) listing some text and other markup. Each item has a radiobutton associated with it, making it possible for the user to select ONE of the items created by the repeater. The repeater writes the radiobutton setting its id and name generated with the default asp.net naming convention making each radiobutton a full 'group'. This means all radiobuttons are independant on each other, which again unfortunately means i can select all radiobuttons at the same time. The radiobutton has the clever attribute 'groupname' used to set a common name so they get grouped together and thus should be dependant (so i can only select one at a time). The problem is - this doesn't work - the repeater makes sure the id and thus the name (which controls the grouping) are different. Since i use a repeater (could have been a listview or any other templated databound control) i can't use the RadioButtonList. So where does that leave me? I know i've had this problem before and solved it. I know almost every asp.net programmer must have had it too, so why can't i google and find a solid solution to the problem? I came across solutions to enforce the grouping by javascript (ugly!) or even to handle the radiobuttons as non-server controls, forcing me to do a Request.Form[name] to read the status. I also tried experimenting with overriding the name attribute on the PreRender event - unfortunately the owning page and masterpage again overrides this name to reflect the full id/name so i end up with the same wrong result. If you have no better solution than i posted, you are still very welcome to post your thoughts - atleast i'll know that my friend 'jack' is right about how messed up 'asp.net' is sometimes ;)

    Read the article

  • Item rendered via a DataTemplate with any Background Brush renders selection coloring behind item.

    - by Mike L
    I have a ListBox which uses a DataTemplate to render databound items. The XAML for the datatemplate is as follows: <DataTemplate x:Key="NameResultTemplate"> <WrapPanel x:Name="PersonResultWrapper" Margin="0" Orientation="Vertical" Background="{Binding Converter={StaticResource NameResultToColor}, Mode=OneWay}" > <i:Interaction.Triggers> <i:EventTrigger EventName="MouseDown"> <cmd:EventToCommand x:Name="SelectPersonEventCommand" Command="{Binding Search.SelectedPersonCommand, Mode=OneWay, Source={StaticResource Locator}}" CommandParameter="{Binding Mode=OneWay}" /> </i:EventTrigger> </i:Interaction.Triggers> <TextBlock x:Name="txtPersonName" TextWrapping="Wrap" Margin="0" VerticalAlignment="Top" Text="{Binding PersonName}" FontSize="24" Foreground="Black" /> <TextBlock x:Name="txtAgencyName" TextWrapping="Wrap" Text="{Binding AgencyName}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="0" FontStyle="Italic" Foreground="Black" /> <TextBlock x:Name="txtPIDORI" TextWrapping="Wrap" Text="{Binding PIDORI}" HorizontalAlignment="Left" VerticalAlignment="Bottom" Margin="0" FontStyle="Italic" Foreground="Black" /> <TextBlock x:Name="txtDescriptors" TextWrapping="Wrap" Text="{Binding DisplayDescriptors}" Margin="0" VerticalAlignment="Top" Foreground="Black"/> <Separator Margin="0" Width="400" /> </WrapPanel> </DataTemplate> Note that there is a value converter called NameResultToColor which changes the background brush of the rendered WrapPanel to gradient brush depending on certain scenarios. All of this works as I'd expect, except when you click on any of the rendered ListBox items. When you click one, there is only the slightest sign of the selection coloring (the default bluish color). I can see a trace bit of it underneath my gradient-brushed item. If I reset the background brush to "no brush" then the selection rendering works properly. If I set the background brush to a solid color, it also fails to render as I'd expect. How can I get the selection coloring to be on top? What is trumping the selection rendering?

    Read the article

  • How to access empty ASP.NET ListView.ListViewItem to apply a style after all databinding is done?

    - by Caroline S.
    We're using a ListView with a GroupTemplate to create a three-column navigation menu with six items in each column, filling in two non-data-bound rows in the last column with an EmptyItemTemplate that contains an empty HTML list item. That part works fine, but I also need to programmatically add a CSS class to the sixth (last) item in each column. That part is also working fine for the first two columns because I'm assigning the CSS class in the DataBound event, where I can iterate through the ListView.Items collection and access the sixth item in the first two columns by using a modulus operator and counter. The problem comes in the last column, where the EmptyItemTemplate has correctly filled in two empty list items, to the last of which I also need to add this CSS class. The empty items are not included in the ListView.Items collection (that's just ListViewDataItems, and the empty items are ListViewItems). I cannot find a way to access the entire collection of ListViewItems after binding. Am I missing something? I know I can access the empty items during ItemCreated, but I can't figure out how to determine where the item I'm creating falls in the flow, and whether it's the last one. Any help would be appreciated, if this can even be done -- I'm a bit stuck.

    Read the article

  • Can't get focus on a TextBox inside a ListBox using Silverlight

    - by Steve Temple
    I'm having a little trouble in silverlight with a listBox containing databound textBox elements. The items display correctly in the list and the textBox is populated correctly but I can't get focus on the text box in the list. If I hover over the edges of the textBox it highlights but it won't let me click into it to edit the text. Any ideas? My XAML looks like this: <ListBox x:Name="listImages"> <ListBox.ItemTemplate> <DataTemplate> <Grid x:Name="LayoutRoot" Background="White"> <Image Height="102" HorizontalAlignment="Left" Name="imgThumb" Stretch="UniformToFill" VerticalAlignment="Top" Width="155" Source="{Binding ImageFilename, Converter={StaticResource ImageConverter}}" /> <TextBox Height="23" HorizontalAlignment="Left" Margin="154,25,0,0" Name="txtAltText" VerticalAlignment="Top" Width="239" Text="{Binding Alt}" /> <dataInput:Label Height="19" HorizontalAlignment="Left" Margin="154,6,0,0" Name="lblAltText" VerticalAlignment="Top" Width="239" Content="Alt Text" /> </Grid> </DataTemplate> </ListBox.ItemTemplate> </ListBox>

    Read the article

  • PHP - Best practice to retain form values across postback

    - by Adam
    Hello, Complete PHP novice here, almost all my previous work was in ASP.NET. I am now working on a PHP project, and the first rock I have stumbled upon is retaining values across postback. For the most simple yet still realistic example, i have 10 dropdowns. They are not even databound yet, as that is my next step. They are simple dropdowns. I have my entire page inclosed in a tag. the onclick() event for each dropdown, calls a javascript function that will populate the corrosponding dropdowns hidden element, with the dropdowns selected value. Then, upon page reload, if that hidden value is not empty, i set the selected option = that of my hidden. This works great for a single postback. However, when another dropdown is changed, the original 1'st dropdown loses its value, due to its corrosponding hidden value losing its value as well! This draws me to look into using querystring, or sessions, or... some other idea. Could someone point me in the right direction, as to which option is the best in my situation? I am a PHP novice, however I am being required to do some pretty intense stuff for my skill level, so I need something flexable and preferribly somewhat easy to use. Thanks! -----edit----- A little more clarification on my question :) When i say 'PostBack' I am referring to the page/form being submitted. The control is passed back to the server, and the HTML/PHP code is executed again. As for the dropdowns & hiddens, the reason I used hidden variables to retain the "selected value" or "selected index", is so that when the page is submitted, I am able to redraw the dropdown with the previous selection, instead of defaulting back to the first index. When I use the $_POST[] command, I am unable to retrieve the dropdown by name, but I am able to retrieve the hidden value by name. This is why upon dropdown-changed event, I call javascript which sets the selected value from the dropdown into its corrosponding hidden.

    Read the article

  • Cannot edit values of DataGridView bound to a BindingList

    - by m_oLogin
    Hello community, I have trouble editing a databound bindinglist. Let me illustrate it with the following: Say I have the Person class: public Class Person{ private string m_firstname; private string m_lastname; public string FirstName{get;set;} public string LastName{get;set;} public Person{ ... } } I then have a containing class called Population: public class Population{ private BindingList<Person> m_lstPerson = new BindingList<Person>(); private string m_countryName; public BindingList<Person> ListPerson{get; set;} public string CountryName { get; set; } } I then have on one form a first datagridview with DataSource = m_lstPopulation (BindingList). The binding works like a charm when working with the Population objects. When I double click, it opens up a dialog form showing the object details. One tab in the details holds a datagridview bound to that population's ListPerson. The second datagridview displays fine. However, I cannot edit or add cells in this datagridview. None of the columns is set to read-only. In fact, both datagridview have just about the same parameters. What am I missing? It seems that a lock has been placed on the Population object so that its inner fields cannot be edited... Please advise. Thanks.

    Read the article

< Previous Page | 1 2 3 4 5 6 7  | Next Page >