I am using silverlight to create an Intranet for managing chemical usage. All data is stored in a MS SQL database, and is retrieved by using a DomainService (RIA).
By dragging the database onto the form, Silverlight has created a DomainDataSource based on this table. By then creating a new record using the following code, I am now able to add new records.
Me.ChemicalApplicationDomainDataSource.DataView.Add(chemicalApplication)
However one of the controls I have on the screen is an AutoCompleteBox. I have bound this to the database, and the values display fine on here. When an item is selected on here, I want to populate the value of a textbox with values retrieved from a second datatable.
I have created an event on the AutoSelectedItemChanged, and added the following code:
Context.Load(Context.GetChemicalByNameQuery(AutoMaterialTradeName.Text))
I can then bind this to a datagrid.ItemsSource, and it shows the relevent record. But I cannot for the life of me get it to bind to a textbox. Textboxes dont have an ItemsSource, only a DataContext, but binding to this does not seem to display anything..
Any tips on how to achieve this?
You would need to bind it to the Text property on the TextBox for that to work. Additionally you would probably need to set the Path property on the binding to get the right property on your object to display.
Related
I had a bunch of asp.net DynamicFields which took care of saving data for me? I had to switch one of the DynamicFields to a DropDownList and now it does not save the selected value? Do I have to override my save functionality or is there something I can set that will still make it save even thought it is not a DynamicField anymore?
you just need to create a custom Field template to house you dropdown list and then set that in the dynamic field using UIHint
hi i have two xml file and i want to bind grid view eith this xml file on client side. i try to describe the complete senerio. in my .aspx page i have a drop down list which has number of department. when the user select the department the data i want the data according to department comes on the grid view from first xml file, in this gridview the rows are field with various tests and the row also have a checkboxes ,when user click on that checkbox the datafrom yhe second xml file will come and the second grid view is bind with that data. i want all that on client side. how is that possible, please help me and thanks in advance for help
I would suggest you to either use jqgrid/html table and use this article to read xml using javascript or if you wants to use gridview only and don't wants to show post back to the user then use updatepannel with gridview will help you out.
I am working with a Telerik Radgrid on an aspx page, which basically has to bind to a datatable, which gets populated by data returned from a web service. I need to be able to fill out some of the columns in the RADGRID based on the data returned by the web service.
For example, I need to be able to build the Hyperlink column based on the parts data returned by the web service. I need a way to access the datasource before the grid item gets populated and direct execution to a routine which builds the URL for the parts on a website.
Can anybody please suggest an efficient way to do this?
I highly appreciate any help/suggestions.
Thanks
Karthik
(Moving my comment to an answer, because I'm thinking this will work out for you.)
You could always cheat and bind it to the grid, allowing you to access the data, but then hide the columns so the users could never get the data.
Let me know how it works out.
EDIT:
My select statement is "select top 5 ProductName from products"
I then created a hyperlink column and assigned the properties under the data tab as such.
When run, it makes the data clickable and when clicked, it navigates to the url seen in the SS.
That what you need?
I'm using Visual Web Developer 2010 Express. This is my first attempt at creating a .NET page. I have a Gridview on a page that displays the results of a GridQuery. This works. I have a checkbox control (cb_Filter) on the same page that if checked, should add to the where clause of the GridQuery, (where Column5 IS NULL). How do I check the state of the check box so it will run the query with or without the "filter".
really depends on your data access, if you have made a datasource on page, then you'll have two and the code will change which data source you have. if it is using the old ado.net then you will have two commands that run in seperate methods that get the sql query, and a similar thing will work for linq. Let me know how you bind to the grid and i will give you an example.
If you want the grid results to change dynamically, autopostback should be True for the checkbox. This will cause the page to reload when the value changes. Then, in your page load routine you do something like this:
If cb_filter.Checked Then
'set the checked datasource or SQL string here
Else
'set the unchecked datasource or SQL string here
End If
I have a question. Let's say I had a number of controls which when I click "Add" the same group of controls would display again.
For example my grouped controls would look like this:
First Name: TEXTBOX
Last Name: TEXTBOX
ADD
When ADD is clicked an additional 2 textboxes appear. So on my page I'd have the following:
First Name: Someones Name
Last Name: Someones last name
First Name: TEXTBOX
Last Name: TEXTBOX
ADD
And so on....
Is there a control (multiview, etc) I could use to do this?
Many thanks in advance,
Jason
I would recommend using a UserControl. You can create them programmatically.
My favorite control in this scenario is the ListView, which allows you to define templates for regular items and the insert row.
Here is multi-part demo on the list view that will show you how it's done.
https://web.archive.org/web/20211020150712/https://www.4guysfromrolla.com/articles/010208-1.aspx
The control is especially effective if you are data binding to a data source, which can be a database or .NET objects. Although not directly applicable to the ListView, you may find this resource helpful, as it describes different uses for Data Sources:
http://msdn.microsoft.com/en-us/magazine/cc163862.aspx
The only way built-in is to use a listview control (or other repeating control) and set it up something like the following: http://mattberseth.com/blog/2008/05/bulk_inserting_data_with_the_l.html
Everytime add is clicked, you have to create a new object from the underlying data source that's blank and rebind the new data source in the listview or other control...
Otherwise, a custom/user control with programmatic creation would get the job done.