how to add text from textbox to split page in windows apps - c#

Ive used a blank page where i have textboxes for a title, subtitle and for a description. Ive added a split page in my app and what i want to do is to be able to get the textbox text from the blank page and add it to the split page where it will be displayed with the details after clicking a button.
Ive checked out how to dynamically add items to a grid view but i want the items to be in the split page format where you click an item on the left side and the description comes to the right side.
Also saw in the splitpage.xaml.cs some TO DO parts where am supposed to bind data and handle selected items i.e
// TODO: Assign a bindable group to this.DefaultViewModel["Group"]
// TODO: Assign a collection of bindable items to this.DefaultViewModel["Items"]
// TODO: Invoke this.itemsViewSource.View.MoveCurrentTo() with the selected
// item as specified by the value of pageState["SelectedItem"]
// TODO: Derive a serializable navigation parameter and assign it to pageState["SelectedItem"]
My question is how do i do that or at least how to add the textbox data to the split page? Any help would be appreciated. Thanks

Related

What determines the order in which data bound text boxes are filled in a form?

I have a form with three text boxes, of which the first and second are bound to the same data binding source. When the form loads, I need the first text box to populate so that the second can use it's data to find it's description and fill the third text box. However, my second text box fills before my first, meaning when the _TextChanged function is called, the first text box's value is an empty string, useless for the third textbox.
What determines the order in which data bound text boxes are filled and how can I change this order so that my first textbox has data when my second text box's _TextChanged function is called?
In the designer view of the form, you can select View -> Other Windows -> Document Outline.
This window allows you to move the order of controls in the form.

How to send multiple gridview rows to another page and populate those rows in the repeater?

I have a repeater showing the rows of data.I have used javascript for user to add new rows to the repeater.
When the new row gets added, a image is displayed on one of the cells .Clicking on that image opens up a new screen.
New screen has ability to search for the records.The search results are shown in a datagrid.
When the user click any of the rows, the same data gets added to the newly added row in repeater of the parent page.
I wish to make this functionality so that mulitple resources can be added at once.
I have put in the check boxes on every row and a button. Button click will add all the checked rows to the repeater in the parent page.
Can you tell me how to handle these multiple rows when sending to the parent page ?
I am using parent.opener to call and pass the values to the parent page.
Thanks
You need to pass the data of selected rows back to the parent. A script library such as jquery can make it a lot simpler. For example,
$('#yourButton').click(function() {
var data = [];
// Assuming grid is CSS class for the grid and selector is CSS class for checkboxes
// that selects rows to copy
$('.grid .selector:checked').parents('tr').each(function() {
var rowData = [];
// slice will ignore first td (assuming that it contains the selector checkbox)
$(this).find('td').slice(1).each(function() {
rowData.push($(this).text());
});
data.push(rowData);
});
// now data will a jagged array - each element will be array of cell values
// pass the data back to your opener
...
});
EDIT:
Corrected a small typo (parents instead of parent).
Also see this jsfiddle for a working illustration that I have put up for you.

Adding textbox value into grid at runtime

I have two textboxes and I want to display their value in a grid.
When I click on the Add button, I want to create a grid dynamically at runtime. I also want to add the textbox values into the grid repeatedly when I want to display it.
ok... As per what you have said you want to create a dynamic grid and and you would like to add Values inside the textbox control inside the gridview? is my understanding is correct ?
check this link out : http://praveensunsetpoint.wordpress.com/2008/05/09/dynamic-gridvieweditdeleteinsertselect-just-copy-paste-and-enjoy-it/

How can I allow the user to edit items in a ListBox?

I want to create a ListBox control that allows the user to edit items, like the list box for extensions in Launchy. Is this possible in WinForms? I tried using Autoit Window Info on that list box and it shows as QWidget (maybe Qt related).
Try using a ListView control, instead.
Set its LabelEdit property to True in order to allow the user to edit the names of the items.
To allow the user to edit the text on a newly-inserted item, you can use the following code:
private void AddItemToListView()
{
// Add a new item to the ListView, with an empty label
// (you can set any default properties that you want to here)
ListViewItem item = listView1.Items.Add(String.Empty);
// Place the newly-added item into edit mode immediately
item.BeginEdit();
}

How to check if either none or all textboxes in an ASP.NET page have text entered?

I am creating an invoice application and in the section where the user can enter line items, some of the fields will include: Quantity, Price, Extended Price, Description, etc.
If the user enters something into any of the fields, the corresponding fields are required, but if no data is entered into any field, then nothing is required in the corresponding fields. What is an efficient and clean way of doing this without doing a bunch of if statements?
I guess this is like doing validation if only one textbox has text.
You could try something like this in the ServerValidate event of a CustomValidator.
// test for all textboxes having some text in them...
e.IsValid = (from TextBox c in this.Controls
where c is TextBox
select c).All(tb => !string.IsNullOrEmpty(tb.Text));
That might need some tinkering to get right - but you get the idea. Change accordingly to test for all textboxes being blank.
You could also use jQuery for the client side validation in your CustomValidator
function clientValidate(sender, e) {
// get array of textboxes with a common css class
var textBoxes = $("#SomeCssSelector input").val();
// loop here to test for having text or no text.
e.IsValid = ... ;
}
You could create a TextBox array and store references to all related text boxes in the array. When ever you need to you could then iterate over the array in a for loop looking for the first item with a value. As soon as you find one with a value you know all the other items in that array also need values.
Additionally, if you have other groups of related text boxes you could create additional arrays to help keep them grouped.
Several ways if this is ASP.NET.
Use field validators that are available in ASP.NET.
Use JavaScript for Windows Forms.
For Windows Forms, also use control validators, or you could use a simple function where you pass a control array. If any item in the array is filled then it requires all items to be filled by returning which fields are not filled, etc.

Categories