|
i have exhausted the javascript solutions or client side solution, i have never thought of carrying the session in a webservice. can you please elaborate on what you mean some post a link that shows what you are suggesting?
thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
If you search on "Silverlight ASP.NET Sessions" you'll find info, for example here's one article:
Access Sessions from Silverlight and ASP.NET[^]
Not sure how you're going to get at the page in the embedded telerik control....you should consult the TElerik documentation for that.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Does ASPX have access to SL protected data storage on the client(I have no idea)?
When you start your SL app pass in a guid from the ASPX shell app and use that in SQL servers temp table. Bloody horrible solution.
I'm passing report criteria from an SL app to a popup via the url, maybe a work around there, maybe a hidden window using the options!
private void DoReport(object sender, RoutedEventArgs e)
{
string sRepName = (sender as Button).Tag.ToString();
string sRepCrit = string.Empty;
switch (sRepName)
{
case "lineset":
sRepCrit = VM.SelectedRoom.RoomID.ToString();
break;
case "equipmentlist":
sRepCrit = GetCriteriaEQ();
break;
}
string sURL = VM.GetReportsAddress( sRepName, sRepCrit);
HtmlPopupWindowOptions options = new HtmlPopupWindowOptions();
options.Left = 0;
options.Top = 0;
options.Width = 810;
options.Height = 600;
if (true == HtmlPage.IsPopupWindowAllowed)
HtmlPage.PopupWindow(new Uri(sURL), "new", options);
}
Never underestimate the power of human stupidity
RAH
|
|
|
|
|
hi Mycroft
You see my problem here is that i have an Silverlight Child Window that is hosting a htmlContainer(Telerik) it is like an iframe object , so this html container is hosting an aspx page, and when that childwindow loads , i store the value to the database and immediately, when the htmlcontainer loaded event gets fired, i have a constructor on the aspx page, that immediately gets the values from the db. This happens so fast that the possibility of a conflict in a multi user environment is less, but i don't trust the approach , i want to retrieve the value and know who's value is for.
thanks
Vuyiswa Maseko,
Spoted in Daniweb-- Sorry to rant. I hate websites. They are just wierd. They don't behave like normal code.
C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.com
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/
|
|
|
|
|
I would like to know how to implement the following xaml in code, specifically the input binding to a command.
<Controls:TextBox Text="{Binding Path=SearchText, UpdateSourceTrigger=PropertyChanged}">
<Controls:TextBox.InputBindings>
<KeyBinding Key="Return" Command="{Binding Path=SearchCommand}"/>
</Controls:TextBox.InputBindings>
</Controls:TextBox>
The reason for the question is i am looking to inherit from some of the default windows controls, and have some standard behaviour for my inherited control. I wish for the return and escape keys to execute a commands in my ViewModel which will be the DataContext for the Inherited Control. The return key would trigger a search to be performed, and the escape key would clear the control to its default value, any help would be greatly appreciated.
|
|
|
|
|
Sounds like the perfect use for attached behaviors!
|
|
|
|
|
The following appears to impelemtn what you suggested, to be honest i'm not sure that i understand the need/benifit to use an attached behaviour insted of inheriting from a control.
public static class LookupBehaviour
{
public static Boolean? GetEscapeToClear(ComboBox comboBox)
{
return (Boolean?) comboBox.GetValue(EscapeToClearProperty);
}
public static void SetEscapeToClear(ComboBox comboBox, Boolean? value)
{
comboBox.SetValue(EscapeToClearProperty, value);
}
public static readonly DependencyProperty EscapeToClearProperty = DependencyProperty.Register("EascapeToClear",
typeof (Boolean?),
typeof (LookupBehaviour),
new UIPropertyMetadata(null, OnEscapeToCearChanged));
private static void OnEscapeToCearChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (!(d is ComboBox)) return;
var cmb = d as ComboBox;
if ((e.NewValue is Boolean?) && (e.NewValue as Boolean?).HasValue)
{
var escapeBindingCommand = new KeyBinding(ApplicationCommands.NotACommand, new KeyGesture(Key.Escape));
var escapeBidning = new Binding("EscapeCommand");
BindingOperations.SetBinding(escapeBindingCommand, InputBinding.CommandProperty, escapeBidning);
cmb.InputBindings.Add(escapeBindingCommand);
}
}
}
One thing that i didn't like was when creating the key binding that you have to specify a tempory command, ApplicationCommands.NotACommand, and then bind over the top of it, if there is any way to avoid that please let me know. Thanks for the origional reply.
|
|
|
|
|
From your original post, it sounded like you wanted to add the same exact functionality to several different controls. If that was/is the case, then think about it: Its easier to write ONE attached behavior vs a bunch of MyComboBox, a MyButton, a MyCheckBox, etc controls and C&P the code.
The behavior you wrote is hard coded to the ComboBox, but it doesn't have to be hard coded to any specific control type, it can be much more generic. Then you can simply attach it to any control you like. Think of something like a tooltip control. By using attached behaviors, you could attach the tooltip to any control you like.
In addition, attached behaviors allow you to modify a controls' behavior without re-templating an entire parent control just to change an embedded control type. I.e. say you had a data grid and wanted to change the behavior on a ComboBox deep down in the visual tree. You'd have to re-template the entire data grid just to change a <ComboBox /> to a <MyComboBox />.
In regards to your last question, there is no need to create a temporary command and use InputBindings. Just subscribe to the KeyDown message and trap the ESC key.
|
|
|
|
|
In my wpf application, there is a listbox a several textboxes.
On clicking an item in the listbox, the textboxes are populated accordingly.
Do you know why the following happens?
select an item in the listbox.
textboxes are populated with other fields for the selected item. Let's say textbox1 has an empty value.
Type "hello" in the textbox.
select another item from the listbox.
Now in the listbox, select the original item you selected. the textbox has the value "hello".
If application is closed and re-opened then obviously the word "hello" is not there.
Do you see why the value is retained eventhough the data is not saved into the database?
Thanks
|
|
|
|
|
It sounds like you have an underlying data item that you are updating in the view model using two way binding. I can't quite decide from your description what your architecture is, but I do think that you aren't raising a change notification when you should be. If you remember, as we've discussed many, many times, WPF uses the INotifyChanged.PropertyChangedEventHandler to manage the update of bound items, so your code must call the PropertyChangedEventHandler at the appropriate point (and you should tell it which property has changed).
Make sure that the class in the DataContext implements INotifyChanged, and then call the event handler as appropriate. Without seeing any of your code, this is pure guesswork and speculation.
|
|
|
|
|
Yes, I think I understand or may be not...
May be I did not explain properly the issue.
I have read your comment several times but I still do not see the solution.
To re-cap:
listbox is populated by fullnames from the database.
on selection of each fullname the textboxes are populated i.e. txtaddress, etc...
If a value is changed in the textbox and submit is pressed then the data gets saved into the database BUT if the save button is not clicked and only you click on another fullname, then when you go back to the first fullname, then the textbox value you entered (which you did not save) will be present.
Surely, the value of the textbox should be as same as what is in the database, right?
Thanks
|
|
|
|
|
arkiboys wrote: Surely, the value of the textbox should be as same as what is in the database,
right?
Not if you've updated it with 2 way binding.
|
|
|
|
|
I think I figured it out because although I have not placed any mode in textbox xaml, by default it is using twoway mode.
Thanks for pointing that out.
|
|
|
|
|
Common property(Not dependency property) will not be bound with the "TwoWay" Mode(Actually, only special dependency property would, when register dependency property there is an option ).If you want bind it "TwoWay",please implement the interface INotifyPropertyChanged in you "Model" Layer.
|
|
|
|
|
You may need to take a look at IEditableObject and IEditableCollectionView. If you'd like to read the blog and download the code sample here[^], you'll get some idea as to how the transaction support in WPF can help you.
|
|
|
|
|
To me this sounds like the correct behaviour, by changing the text you have changed the property in your data context, and although you have not commited this to the database you are not refreshing the data from the database when re selecting the item. If you wish for any changed to be undone if you do not press the save button you may wish to consider calling
ObjectContext.Refresh(RefreshMode.StoreWins, WhatToRefresh);
The WhatToRefresh could be ObjectContext.NamesSourceTable, or to be more graceful you could just pass the previously slected item, i would guess that you call this when you change the slected item on the list. If you need a more full solution post a you code and i'll try to edit it for you.
|
|
|
|
|
Why have you posted this to me? The OP doesn't get notified on replies to other people's comments, and I am more than fully aware of how binding works in WPF/SL.
|
|
|
|
|
clicked the wrong reply link by mistake i guess, was simply trying to offer a solution to the OP.
|
|
|
|
|
No problems. Simply add a reply to one of his posts and link to the answer you gave there.
|
|
|
|
|
To me this sounds like the correct behaviour, by changing the text you have changed the property in your data context, and although you have not commited this to the database you are not refreshing the data from the database when re selecting the item. If you wish for any changed to be undone if you do not press the save button you may wish to consider calling
ObjectContext.Refresh(RefreshMode.StoreWins, WhatToRefresh);
The WhatToRefresh could be ObjectContext.NamesSourceTable, or to be more graceful you could just pass the previously slected item, i would guess that you call this when you change the slected item on the list. If you need a more full solution post a you code and i'll try to edit it for you.
|
|
|
|
|
We have one screen that has a datagrid. The datagrid contains the entire object (Parcel) and displays 3 fields in the display. The display is intended to be as such:
All parcels for a given site.
Highlight (or use a checkbox) to display those parcels that pertain to this record.
We can always do it the old way -- iterate thru the existing elements manually turning on the checkbox. But I prefer to keep this loosely bound. We've tried a few things but we both get brain freeze when coming up with the next approach.
Any suggestions on deploying this display of a query that intersects a subquery?
|
|
|
|
|
How about using a value converter[^]?
A converter would be called as each row binds to the datagrid.
The funniest thing about this particular signature is that by the time you realise it doesn't say anything it's too late to stop reading it.
|
|
|
|
|
Thanks for the suggestion but the passing of the subquery is where ValueConverter fails.
MSDN suggested that I implement an Interaction.Trigger and invoke a DelegateCommand.
I'm going to give that route a try.
Michael
|
|
|
|
|
Not sure why you need a sub-query. Can you not bind the checkbox to the site of the parcel, use a value converter passing in the current site as a converter parameter and return true if they are equal?
|
|
|
|
|
Not sure why you need a sub-query. Can you not bind the checkbox to the record id of the parcel, use a value converter passing in the current record id as a converter parameter and return true if they are equal?
|
|
|
|