Click here to Skip to main content
15,897,704 members
Home / Discussions / WPF
   

WPF

 
GeneralRe: Access an Element using reflection Pin
Pete O'Hanlon11-Feb-11 9:08
mvePete O'Hanlon11-Feb-11 9:08 
AnswerRe: Access an Element using reflection Pin
dasblinkenlight10-Feb-11 15:20
dasblinkenlight10-Feb-11 15:20 
Questionmemory usage Pin
arkiboys8-Feb-11 23:11
arkiboys8-Feb-11 23:11 
AnswerRe: memory usage Pin
Pete O'Hanlon9-Feb-11 0:49
mvePete O'Hanlon9-Feb-11 0:49 
AnswerRe: memory usage Pin
Steve Maier9-Feb-11 4:27
professionalSteve Maier9-Feb-11 4:27 
GeneralRe: memory usage PinPopular
arkiboys9-Feb-11 5:25
arkiboys9-Feb-11 5:25 
GeneralRe: memory usage Pin
Steve Maier9-Feb-11 7:36
professionalSteve Maier9-Feb-11 7:36 
QuestionStored Procedure Population of Silverlight Combo Box Pin
VSS712J8-Feb-11 9:41
VSS712J8-Feb-11 9:41 
New to Silverlight - Using four areas Three of which looking for guidance to make a combo box work in a Silverlight Grid from a stored procedure:
Any thoughts are much appreciated


Hello,
I am new to silverlight. Can some please guide me with the appropriate syntax for displaying a combo lookup box which is being loaded by a stored procedure? In addition, can you tell me how to turn on and off the Display of the combo box. It requires two clicks to open the combo box. Here is my code:
XAML
<sdk:datagridtemplatecolumn x:name="patIdEssentrisColumn" header="Pat Id Essentris" width="SizeToHeader">
<sdk:datagridtemplatecolumn.celltemplate>
<datatemplate>
<textblock margin="2" text="{Binding PatIdEssentris}">


<sdk:datagridtemplatecolumn.celleditingtemplate>
<datatemplate>

<combobox name="cboTest"
=""
itemssource="{Binding GetComboboxItems_PatIdEssentris}"
displaymemberpath="PatientName">





Combo Box Class
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using System.Data;
using System.Data.SqlClient;
using System.Configuration;
namespace CorporateHR.Web
{
public class ComboBoxItem
{
[Key]
public int ComboID_Int { get; set; }
public string ComboDisplayValue { get; set; }
private static List<comboboxitem> GetComboBoxItems(string strStoredProcedure)
{
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["RefConnectionString"].ConnectionString);
SqlCommand cmd = new SqlCommand(strStoredProcedure, con);
cmd.CommandType = System.Data.CommandType.StoredProcedure;

List<comboboxitem> comboList = new List<comboboxitem>();
con.Open();
SqlDataReader dr = cmd.ExecuteReader(behavior: CommandBehavior.CloseConnection);
while (dr.Read())
{
ComboBoxItem ComboBoxItem = new ComboBoxItem();
ComboBoxItem.ComboID_Int = Convert.ToInt32(dr[0].ToString());
ComboBoxItem.ComboDisplayValue = dr[1].ToString();
comboList.Add(ComboBoxItem);
}
return comboList;
}
public static List<comboboxitem> GetComboboxItems_PatIdEssentris()
{
return GetComboBoxItems("uspLookupPatIdEssentris");
}
//Secondary ComboBox Lookup:
public static List<comboboxitem> GetComboboxItems_Department()
{
return GetComboBoxItems("uspLookupPatIdEssentris");
}
}
}
Code Behind Page
namespace CorporateHR
{
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using CorporateHR.LoginUI;
public partial class MainPage : UserControl
{
public MainPage()

{
InitializeComponent();

this.loginContainer.Child = new LoginStatus();
this.Loaded += new RoutedEventHandler(Page_Loaded);
}

void Page_Loaded(object sender, RoutedEventArgs e)
{this.employeeDataGrid.ItemsSource = GetComboboxItems_PatIdEssentris();}

private object GetComboboxItems_PatIdEssentris()
{
throw new System.NotImplementedException();
}
AnswerRe: Stored Procedure Population of Silverlight Combo Box Pin
Vimalsoft(Pty) Ltd8-Feb-11 19:57
professionalVimalsoft(Pty) Ltd8-Feb-11 19:57 
GeneralRe: Stored Procedure Population of Silverlight Combo Box [modified] Pin
VSS712J11-Feb-11 8:17
VSS712J11-Feb-11 8:17 
GeneralRe: Stored Procedure Population of Silverlight Combo Box Pin
Pete O'Hanlon11-Feb-11 9:10
mvePete O'Hanlon11-Feb-11 9:10 
GeneralRe: Stored Procedure Population of Silverlight Combo Box Pin
VSS712J11-Feb-11 10:29
VSS712J11-Feb-11 10:29 
Questionpaint eclipse control Pin
arkiboys7-Feb-11 4:13
arkiboys7-Feb-11 4:13 
AnswerRe: paint eclipse control Pin
Pete O'Hanlon7-Feb-11 4:27
mvePete O'Hanlon7-Feb-11 4:27 
GeneralRe: paint eclipse control Pin
arkiboys7-Feb-11 4:32
arkiboys7-Feb-11 4:32 
GeneralRe: paint eclipse control Pin
Pete O'Hanlon7-Feb-11 4:37
mvePete O'Hanlon7-Feb-11 4:37 
QuestionMultiple SilverLight apps Pin
Ray Cassick5-Feb-11 13:00
Ray Cassick5-Feb-11 13:00 
AnswerRe: Multiple SilverLight apps Pin
Abhinav S5-Feb-11 17:51
Abhinav S5-Feb-11 17:51 
GeneralRe: Multiple SilverLight apps Pin
Ray Cassick11-Feb-11 11:07
Ray Cassick11-Feb-11 11:07 
AnswerRe: Multiple SilverLight apps Pin
RichardGrimmer11-Feb-11 4:52
RichardGrimmer11-Feb-11 4:52 
GeneralRe: Multiple SilverLight apps Pin
Ray Cassick11-Feb-11 11:05
Ray Cassick11-Feb-11 11:05 
QuestionC# Client Server Application on WPF IDE Pin
LAPEC4-Feb-11 1:48
LAPEC4-Feb-11 1:48 
AnswerRe: C# Client Server Application on WPF IDE Pin
RobCroll4-Feb-11 1:54
RobCroll4-Feb-11 1:54 
AnswerRe: C# Client Server Application on WPF IDE Pin
Pete O'Hanlon4-Feb-11 1:57
mvePete O'Hanlon4-Feb-11 1:57 
AnswerRe: C# Client Server Application on WPF IDE Pin
Abhinav S4-Feb-11 5:12
Abhinav S4-Feb-11 5:12 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.