consider the following classes (similar to the ones i am working with): [CODE] namespace Project { public class Person { public Person() { } private string name; public string Name { get { return name; } set { name = value; } } private List<Pet> myPets; public List<Pet> MyPets { get { return myPets; } set { myPets = value; } } } } [/CODE] [CODE] namespace Project { public class Pet { public Pet() { } private int numberOfPaws; public int NumberOfPaws { get { return numberOfPaws; } set { numberOfPaws = value; } } } } [/CODE] Lets …

Member Avatar
Member Avatar
+0 forum 4

Did you know that you can data bind a bitmap to a PictureBox's image property, and the source image doesn't have to be in a binary format stored in a data table? Using a standard object setup for data binding (iNotify etc.) you can easily update your program's image propertie's from one place.

Member Avatar
+0 forum 0

I need to bind a property to a ToolStripMenuItem. I've searched around and found it imposible, the best workaround seems to be creating a BindableToolStripMenuItem class and implement it yourself. So I've taken some reasonabyl well established code from the internet: public partial class BindableToolStripMenuItem : ToolStripMenuItem,IBindableComponent { private BindingContext bindingContext; private ControlBindingsCollection dataBindings; [Browsable(false)] public BindingContext BindingContext { get { if (bindingContext == null) bindingContext = new BindingContext(); return bindingContext; } set { bindingContext = value; } } [DesignerSerializationVisibility(DesignerSerializationVisibility.Content)] public ControlBindingsCollection DataBindings { get { if (dataBindings == null) dataBindings = new ControlBindingsCollection(this); return dataBindings; } } } Now …

Member Avatar
Member Avatar
+0 forum 1

Hi my name is vishal. For the past 1 week i been in the process of creating a dashboard using listview in c# windows forms with sql server 2008. I created listview named lstDashItems and populate it from a table named USERACTIVITIES in sql server 2008. The design of USERACTIVITIES table in sql server 2008. Column Name Data Type Allow Nulls user_id int yes row_upd_date datetime yes activity varchar(50) yes type int yes ref_id numeric(18,0) yes I have created a method in MdiParent Form named updateUserActivities() Given below is the code in my MdiParent Form of Method/function updateUserActivities: public void …

Member Avatar
Member Avatar
+0 forum 2

I am using dynamic ItemTemplate for ListView which populated from database.Here is how I do when I need to display string column "Parametr" (or some other datatypes): //my .ascx file <li><%# Eval("Parametr") %> </li> How can I display varbinary column that stores images?Thanks. Here is some more code if somebody needed: <asp:ListView ... DataSourceID="database" ></asp:ListView> <asp:SqlDataSource ... ID="database" SelectCommand="SELECT image FROM image_table"

Member Avatar
Member Avatar
+0 forum 1

hi, This is a bit complex.. I have 2 nested repeaters.. and 3 datasources(in markup) <asp:SqlDataSource ID=data1 runat=server ConnectionString="<%$connectionstrings:MainServer %>" SelectCommand="select MatrixRiskFactorId,Name,MaxWeight from Matrixriskfactor" ></asp:SqlDataSource> <asp:SqlDataSource ID=data2 runat=server ConnectionString="<%$connectionstrings:MainServer %>" SelectCommand="select * from MatrixQuestion" ></asp:SqlDataSource> <asp:SqlDataSource ID=data3 runat=server ConnectionString="<%$connectionstrings:MainServer %>" SelectCommand = "select MatrixRiskFactorId,Value,text from MatrixRiskFactorScore where MatrixRiskFactorId=2"> <repeater id=rep1 datasourceid=data1> <itemtemplate> <%# DataBinder.Eval(Container.DataItem, "Name")%> <br/> <repeater id=rep2 datasourceid=data2> <headertemplate> <table> <th>Question</th><th>Score</th> <itemtemplate> <tr> <td> <%# DataBinder.Eval(Container.DataItem,"text") %> </td> <td> <asp:RadioButtonList id=radiolist1 runat=server DataSourceID=data3 DataTextField="text" DataValueField="value" ></asp:RadioButtonList> </td> </tr> </ItemTemplate> <FooterTemplate> </table> </FooterTemplate> </itemtemplate> </itemtemplate> </repeater> ================================================== **as you can see in data3.. the where clause has a fixed value...(2)** …

Member Avatar
Member Avatar
+0 forum 3

I am having trouble with databinding when trying to add it to a dropdownlist. I can get it to work with a label: <asp:Label ID="Label3" runat="server" Text='<%# Eval("Location") %>'></asp:Label> But when I try with the DropDownList I get this error and I can't seem to find an answer for it. Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.ListItem does not have a DataBinding event. Here is the code I use: <asp:DropDownList ID="ddlLocation1" runat="server"> <asp:ListItem Text='<%# Eval("Location") %>' Value='<%# Eval("TotalCost") %>' /> </asp:DropDownList> Any help would be greatly appreciated.

Member Avatar
Member Avatar
+0 forum 5

I am having trouble with databinding when trying to add it to a dropdownlist. I can get it to work with a label: <asp:Label ID="Label3" runat="server" Text='<%# Eval("Location") %>'></asp:Label> But when I try with the DropDownList I get this error and I can't seem to find an answer for it. Databinding expressions are only supported on objects that have a DataBinding event. System.Web.UI.WebControls.ListItem does not have a DataBinding event. Here is the code I use: <asp:DropDownList ID="ddlLocation1" runat="server"> <asp:ListItem Text='<%# Eval("Location") %>' Value='<%# Eval("TotalCost") %>' /> </asp:DropDownList> Any help would be greatly appreciated.

Member Avatar
Member Avatar
+0 forum 1

Hi, I'm having a problem with a datetimepicker and databinding. I bind the text of the picker to a value from the database and it works perfectly fine and shows the value correctly, however whenever i change the text in the datetimepicker field to update, it changes, BUT gets back again to its original value when i advance to another textfield or any other control on the form. anyone has an idea why this is happening?

Member Avatar
Member Avatar
+0 forum 2

I created a table in mySql named 'user' where fields are: UserID,UserFirstName,UserMidName,UserLastName,Username,UserType,AcctPassword,DateCreated, DatLastModified and IsDeleted. I create a separate form in vb.net to insert user record in database. My program can do insert command and bound this data from mySql to datagridview. And now, i wanted to update this by binding data in datagridview into the form(which i was created to insert record) textboxes. Please let me know how. Thanks in advance.

Member Avatar
Member Avatar
+0 forum 1

hi! i have a listbox binded to a list. the list contains checkboxes binded to a field/member of the list. what i want to achieve is that i want to delete the data from list when it's corresponding checkbox is checked... here's my xaml code: [CODE]<ListBox Name="ListBox1" ItemsSource="{Binding histList, Mode=OneWay}" Margin="10,10,10,10" Height="197" VerticalAlignment="Center" > <ListBox.ItemTemplate> <DataTemplate> <CheckBox Content="{Binding FilterName, Mode=TwoWay}" /> </DataTemplate> </ListBox.ItemTemplate> </ListBox>[/CODE] here's the code in the .cs file [CODE]namespace ReportsUIScreens { public partial class EditStyle : ChildWindow { private List<filterHistory> histList; public EditStyle(List<filterHistory> histListLink) { InitializeComponent(); histList = histListLink; this.ListBox1.ItemsSource=histList; } private void OKButton_Click(object sender, RoutedEventArgs e) …

Member Avatar
Member Avatar
+0 forum 1

Hi, I am working on a project for work that requires the <%# Now() %> function output to be inserted into a text box field that passes it's value to an Access 2007 DB with the rest of the form data on submission. I am able to either make the textbox field display the Date/Time Stamp or for it to bind to the DB but can't do both. Any assistance would be appreciated. :-) I am using FormView in InsertItem mode.

Member Avatar
Member Avatar
+0 forum 1

Hi <%# ((DataRowView)Container.DataItem)["SomeProperty"] %> <%# DataBinder.Eval(Container.DataItem, "SomeProperty")%> From Google i figured out these can be used to bind the columns in GridView to ArrayList. But what is "some property" ? For example i have a ArrayList in .aspx.cs as static ArrayList componentSelectionArray = new ArrayList(); so can i just write in grid view to bind a arraylist to gridview columns as: <asp:GridView ID= "GridView1" runat="server" AutoGenerateColumns="true"> <Columns> <asp:TemplateField HeaderText="ComponentName"> <ItemTemplate> <asp:Label ID="" text= "<%# DataBinder.Eval(Container.DataItem, "componentSelectionArray")%>" ></asp:Label> </ItemTemplate> </asp:TemplateField> </asp:GridView> Please help me Thank you in anticipation

Member Avatar
Member Avatar
+0 forum 1

Hello, I posted yesterday regarding my issues with adding rows to a database, this is now solved and I am grateful. Once the rows were added to the database the list box that displays one column of the database did not update so I included the following code after the addition had been made: [CODE] cnn.ConnectionString = "Data Source=FYPSERVER;Initial Catalog=FYP;Integrated Security=True"; cnn.Open(); da.Fill(fypDataSet, "category"); cnn.Close();[/CODE] I assume this refilled the data adapter with the updated information and it worked, my list box and its values were updated. However the same bit of code does not work after I delete a …

Member Avatar
Member Avatar
+0 forum 7

Hi All, I have created a form for a user to create a booking of a meeting room, I need this form to do 3 things. have print functionality update the new booking to a dataset view the current bookings screen I seem to be struggling with the second task, when I try and save my new booking I get this error [CODE] System.InvalidOperationException was unhandled Message="Update unable to find TableMapping['mtrbookings'] or DataTable 'mtrbookings'." [/CODE] Please see the code for my form. [CODE] Imports System.Data.SqlClient Public Class Form1 Dim conn As SqlConnection Dim Bookings As SqlDataAdapter Dim dsBookings As DataSet …

Member Avatar
Member Avatar
+0 forum 5

Hi, I've been using VB.NET for quite a while now, and would definitely consider myself beyond a beginner. However, I have never attempted to use Data binding before, and have read [I]lots[/I] of stuff online about it, but I [I]still[/I] don't understand quite how it works. I have a form where the user puts in the username and password (VB 2008 Express), and I want to save what the user puts in so they can be retrieved later for login purposes. I have added a database to the project, and please note that I [B]don't[/B] have MS Access (but do …

Member Avatar
Member Avatar
+0 forum 2

I have found that [CODE]Me.DataBindings.Item(0).BindingMemberInfo.BindingField[/CODE] gives me the name of the field. Can I also find the datacolumncollection in this way?

Member Avatar
+0 forum 0

I have a ListView which is filled by generic list of type MyClass. I can easily bind data from this list into ListView. But I have problems with reading data in opposite direction. This is my class: [CODE] public class MyClass { public int id { get; set; } public string name { get; set; } } [/CODE] I have also generic list of type MyClass: [CODE] List<MyTest> list = new List<MyTest>(); [/CODE] Finally I bind data to ListView this way: [CODE] ListView1.DataSource = list; ListView1.DataBind(); [/CODE] My ListView template: [CODE] <asp:ListView runat="server" ID="ListView1"> <LayoutTemplate> <table runat="server" id="table1" > <tr …

Member Avatar
Member Avatar
+0 forum 4

For the solution, I cannot use any postback methods, because this is all working through ajax. The solution need to be implemented in the asp.net code. I have a `List<WebPage>` that contains a list of Links `(List<Link>)` and I need for all the links to bind repetitive information such as page title, id, url. Here is my current repeater. [CODE] <div id="result"> <asp:Repeater runat="server" id="results"> <Itemtemplate> <asp:Repeater runat="server" datasource='<%# Eval("Links") %>'> <Itemtemplate> <tr class="gradeX odd"> <td><%# Eval("Id") %></td> //property of WebPage (part of results repeater) <td><%# Eval("Title") %></td> //property of WebPage (part of results repeater) <td><%# Eval("Url") %></td> //property of …

Member Avatar
Member Avatar
+0 forum 2

The End.