I want to get row value after i click a cell. I try using SelectionChanged and follow so many Q&A in many forum and still can't do this. maybe if you guys can give me an example for this, maybe after click a cell it will give message about every value in that row?
here is my whole code, i hope telerik team can help me.
XAML
<
Grid
>
<
StackPanel
x:Name
=
"xPanel"
>
<
telerik:RadGridView
x:Name
=
"dataGrid"
AutoGenerateColumns
=
"False"
ColumnWidth
=
"*"
ShowGroupPanel
=
"False"
CanUserReorderColumns
=
"False"
ItemsSource
=
"{Binding}"
SelectionChanged
=
"dataGrid_SelectionChanged"
>
<
telerik:RadGridView.Columns
>
<
telerik:GridViewDataColumn
Header
=
"idx"
DataMemberBinding
=
"{Binding idx}"
/>
<
telerik:GridViewDataColumn
Header
=
"tag"
DataMemberBinding
=
"{Binding tag}"
/>
<
telerik:GridViewDataColumn
Header
=
"value"
DataMemberBinding
=
"{Binding value}"
/>
</
telerik:RadGridView.Columns
>
</
telerik:RadGridView
>
<
telerik:RadButton
Content
=
"Update"
Height
=
"30"
Click
=
"RadButton_Click"
/>
</
StackPanel
>
</
Grid
>
CS
namespace
Setting
{
public
partial
class
MainWindow : Window
{
ScimoreDataAdapter dataAdp;
DataSet ds;
public
MainWindow()
{
InitializeComponent();
string
dbInstanceName =
"C:\\Users\\Abc\\Documents\\Visual Studio 2010\\Projects\\Setting\\Setting\\configdb"
;
ScimoreEmbedded em =
new
ScimoreEmbedded();
em.Open(dbInstanceName);
try
{
using
(ScimoreConnection cn = em.CreateConnection())
{
cn.Open();
string
query =
"select idx,tag,value from config.info"
;
dataAdp =
new
ScimoreDataAdapter(query, cn);
DataTable dataTable =
new
DataTable(
"info"
);
ds =
new
System.Data.DataSet();
dataAdp.Fill(ds,
"info"
);
dataGrid.ItemsSource = ds.Tables[0];
dataAdp.Update(ds,
"info"
);
}
}
catch
(Exception)
{
}
}
private
void
RadButton_Click(
object
sender, RoutedEventArgs e)
{
}
private
void
dataGrid_SelectionChanged(
object
sender, SelectionChangeEventArgs e)
{
//System.Data.DataRowView CurrentSelected = ((System.Data.DataRowView)dataGrid.SelectedItem);
//MessageBox.Show(Convert.ToString(CurrentSelected.Row.ItemArray[1]));
}
}
}