8

I'm a new to ASPX, hope you dont mind if my problem is so simple with somebody.

I use a List<object> selectedValues;

selectedValues=...list of object(item1, item2,..)

Each object has 3 fields: id, title, and content.

foreach (object[] item in selectedValues)
{
  foreach (object value in item)
  {
    string result += string.Format("{0}    ", value);
    Textbox1.Text= result;--> all field is displayed in one Textbox.
  }
}

My problem is: how can I get the single field, I mean:

foreach (object value in item)
            {
                TextBox1.Text = id...???
                TextBox2.Text= title...???
                TextBox3.Text= content...???
}

According to my comment, here is converter:

class SecurityLevelToVisibilityConverter : IValueConverter
{
    public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return !(int.Parse((string)value) < int.Parse((string)parameter)) ? Visibility.Visible : Visibility.Collapsed;
    }

    public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
    {
        return null;
    }
}

And here is an example of how you can use it in XAML:

<Button Style="{StaticResource MyButtonStyle}" 
        DataContext="{DynamicResource System.CurLevel}" 
        Visibility="{Binding Path=Value, Converter={StaticResource SecurityLevelToVisibilityConverter}, ConverterParameter=3}"/>

"ConverterParameter=3" means that users with security level of "3" can see the button.

4

2 に答える 2