.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> WPF >> Post New QuestionBookmark and Share Subscribe to Forum

How To Find the Combobox in Wpf

Posted By: Aamrapali Tamgadge     Posted Date: April 30, 2013    Points:5   Category :WPF
Hello sir.i m having two combobox inside my datagrid .now i have a problem that how to find it.i have done below code to find single one it is working but what about the second one.

<DataGridTemplateColumn Header="Expert Name" x:Name="MyColumn">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="MyComboBox" Width="230" Height="22" SelectedValuePath="expertcode" DisplayMemberPath="expertname" ItemsSource="{Binding Expertname}"
SelectedIndex="0" Loaded="MyComboBox_Loaded" SelectionChanged="MyComboBox_SelectionChanged" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>


<DataGridTemplateColumn Header="Expert Substitute Name" x:Name="MyColumnsub">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<ComboBox x:Name="cmbsubtitue" Width="230" Height="22" SelectedValuePath="expertcode" DisplayMemberPath="expertname" ItemsSource="{Binding Expertname}"
SelectedIndex="0" Visibility="Visible"/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>





-------------------my Code is------------
for (int i = 0; i < dtteacher1.Rows.Count; i++)
{
mp.Mode = "Update";
ac.Advccode = Convert.ToInt32(dtteacher1.Rows[i]["advcommitteecode"].ToString());
DataGridRow row = (DataGridRow)this.gridteacher2.ItemContainerGenerator.ContainerFromIndex(i);
if (row != null)
{
ComboBox cb2 = GetVisualChild<ComboBox>(row);
if (cb2 != null)
{
ac.Expertcode = Convert.ToInt32(cb2.SelectedValue);
// string name = cb.Text;
if (ac.Expertcode == 0)
{
ac.Expertcode = Convert.ToInt16(null);

}
}
}

mp.Mname = GlobalVar.GlobalValue;
r = ab.BAL_InsertComitee(mp, ac);
}


Responses

No response found. Be the first to respond this post
Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend