Hello all
I have a problem i have some dynamic button.and i want to store integer value in that.
and get that value on that click event of that button how can i achieve it
thanks in advance
shashank
DataView dv = new DataView(dtCat, "PK_CATEGORY_ID IN(" + categoryIds.ToString() + "0)", "PK_CATEGORY_ID", DataViewRowState.CurrentRows);
foreach (DataRowView rr in dv)
{
//MessageBox.Show(rr[0].ToString() + "------------" + rr[1].ToString());
Button b2 = new Button();
//b2.Name = rr[0].ToString();
b2.Name = "";
b2.Height = 200;
b2.Width = 200;
b2.Margin = new Thickness(0, -100, 0, 0);
b2.HorizontalAlignment = HorizontalAlignment.Left;
b2.Content = rr[1].ToString();
b2.Background = System.Windows.Media.Brushes.Pink;
b2.Click += new RoutedEventHandler(b2_Click);
btncanvas.Children.Add(b2);
Canvas.SetLeft(b2, b2.Width * i);
i = i + 1;
MessageBox.Show(rr[0].ToString());
b2.Tag = rr[0].ToString();
}
void b2_Click(object sender, RoutedEventArgs e)
{
Button clicked = (Button)sender;
categoryname = clicked.Name;
}