Click here to Skip to main content
15,902,112 members
Home / Discussions / WPF
   

WPF

 
AnswerRe: Silverlight + WCF Communication Pin
Mark Salsbery10-Jun-09 6:53
Mark Salsbery10-Jun-09 6:53 
GeneralRe: Silverlight + WCF Communication Pin
JS 200810-Jun-09 17:54
JS 200810-Jun-09 17:54 
GeneralRe: Silverlight + WCF Communication Pin
Mark Salsbery11-Jun-09 10:22
Mark Salsbery11-Jun-09 10:22 
QuestionHow to get images in Application's folder Pin
Nekkantidivya10-Jun-09 2:40
Nekkantidivya10-Jun-09 2:40 
AnswerRe: How to get images in Application's folder Pin
User 27100910-Jun-09 5:00
User 27100910-Jun-09 5:00 
AnswerRe: How to get images in Application's folder Pin
ABitSmart10-Jun-09 5:03
ABitSmart10-Jun-09 5:03 
AnswerRe: How to get images in Application's folder Pin
varun 200924-Feb-10 20:35
varun 200924-Feb-10 20:35 
QuestionWPF Datagrid? Pin
S Rajput9-Jun-09 15:37
S Rajput9-Jun-09 15:37 
Hello,

What i am doing is, i am creating a Datatable based on values that user fills up in the form.
Further i am assigning that datatable to the WPF datagrid to display the Grid.
dgMatrix.ItemsSource = GetDataSource.DefaultView

Now, as the user edits the grid and presses the SAVE button under the grid, I would like to save all the rows of the Grid into a new table in the database.

Is there a way to loop through each row of the Grid and then inserting each record into the database??
In ASP.net i was using the following function:

'For Each row As GridViewRow In dgMatrix.Rows

'
' Dim checkbox As CheckBox = CType(row.FindControl("cbRows"), CheckBox)

' If checkbox.Checked Then

' Try

' Dim txtFromPorts As TextBox = CType(row.FindControl("txtPortsFrom"), TextBox)
' Dim txtToPorts As TextBox = CType(row.FindControl("txtPortsTo"), TextBox)
' Dim txtFType As TextBox = CType(row.FindControl("txtFareType"), TextBox)
' Dim txtFClass As TextBox = CType(row.FindControl("txtFareClass"), TextBox)
' Dim txtLowGAmt As TextBox = CType(row.FindControl("txtGrossAmtLow"), TextBox)
' Dim txtLowNAmt As TextBox = CType(row.FindControl("txtNettAmtLow"), TextBox)
' Dim txtHighGAmt As TextBox = CType(row.FindControl("txtGrossAmtHigh"), TextBox)
' Dim txtHighNAmt As TextBox = CType(row.FindControl("txtNettAmtHigh"), TextBox)
' Dim txtPeakGAmt As TextBox = CType(row.FindControl("txtGrossAmtPeak"), TextBox)
' Dim txtPeakNAmt As TextBox = CType(row.FindControl("txtNettAmtPeak"), TextBox)

' ' Dim dr As DataRow = dtNew.NewRow

' strFrom = txtFromPorts.Text
' strTo = txtToPorts.Text
' strFareType = txtFType.Text
' If txtFClass.Text.Trim <> "" Then
' strFareClass = txtFClass.Text
' End If

' If txtLowGAmt.Text <> "" Then
' strGrossLow = txtLowGAmt.Text
' End If
' If txtLowNAmt.Text <> "" Then
' strNettLow = txtLowNAmt.Text
' End If
' If txtHighGAmt.Text <> "" Then
' strGrossHigh = txtHighGAmt.Text

' End If

' If txtHighNAmt.Text <> "" Then
' strNettHigh = txtHighNAmt.Text
' End If

' If txtPeakGAmt.Text <> "" Then
' strGrossPeak = txtPeakGAmt.Text
' End If

' If txtPeakNAmt.Text <> "" Then
' strNettPeak = txtPeakNAmt.Text
' End If

' 'Check if the checkbox is checked.



' strSQL = "INSERT INTO FareInfo (" + _
' "FareId," + _
' "PortsFrom," + _
' "PortsTo," + _
' "FareType," + _
' "FareClass," + _
' "GrossAmtLow," + _
' "NettAmtLow," + _
' "GrossAmtHigh," + _
' "NettAmtHigh," + _
' "GrossAmtPeak," + _
' "NettAmtPeak" + _
' ") VALUES ("

' If (strFareId <> "") Then
' strSQL = strSQL + "'" + strFareId + "',"
' strSQL = strSQL + "'" + strFrom + "',"
' strSQL = strSQL + "'" + strTo + "',"
' strSQL = strSQL + "'" + strFareType + "',"
' strSQL = strSQL + "'" + strFareClass + "',"
' If strGrossLow <> "" Then
' strSQL = strSQL + " " & strGrossLow & " ,"
' Else
' strSQL = strSQL + " " & "null" & " ,"
' End If

' If strNettLow <> "" Then
' strSQL = strSQL + "" + strNettLow + ","
' Else
' strSQL = strSQL + " " & "null" & " ,"
' End If

' If strGrossHigh <> "" Then
' strSQL = strSQL + "" + strGrossHigh + ","
' Else
' strSQL = strSQL + " " & "null" & " ,"
' End If

' If strNettHigh <> "" Then
' strSQL = strSQL + "" + strNettHigh + ","
' Else
' strSQL = strSQL + " " & "null" & " ,"
' End If
' If strGrossPeak <> "" Then
' strSQL = strSQL + "" + strGrossPeak + ","
' Else
' strSQL = strSQL + " " & "null" & " ,"
' End If
' If strNettPeak <> "" Then
' strSQL = strSQL + "" + strNettPeak + ""
' Else
' strSQL = strSQL + " " & "null" & " "
' End If

' strSQL = strSQL + ")"

' End If
' DBClass.ExecuteQuery(strSQL)
' gvMatrix.Visible = False


' 'Insert 1 row in Progress grid






' Catch ex As Exception



' End Try


' End If

'Next


Can someone suggest me the right way to do so in WPF. I would really appreciate that, Thanks.
AnswerRe: WPF Datagrid? Pin
Christian Graus9-Jun-09 15:48
protectorChristian Graus9-Jun-09 15:48 
GeneralRe: WPF Datagrid? Pin
S Rajput9-Jun-09 16:37
S Rajput9-Jun-09 16:37 
GeneralRe: WPF Datagrid? Pin
Christian Graus9-Jun-09 17:17
protectorChristian Graus9-Jun-09 17:17 
GeneralRe: WPF Datagrid? Pin
S Rajput9-Jun-09 19:08
S Rajput9-Jun-09 19:08 
GeneralRe: WPF Datagrid? Pin
S Rajput9-Jun-09 19:33
S Rajput9-Jun-09 19:33 
GeneralRe: WPF Datagrid? Pin
Christian Graus9-Jun-09 20:33
protectorChristian Graus9-Jun-09 20:33 
GeneralRe: WPF Datagrid? Pin
S Rajput9-Jun-09 20:58
S Rajput9-Jun-09 20:58 
GeneralRe: WPF Datagrid? Pin
Pete O'Hanlon9-Jun-09 21:53
mvePete O'Hanlon9-Jun-09 21:53 
GeneralRe: WPF Datagrid? Pin
Christian Graus9-Jun-09 22:24
protectorChristian Graus9-Jun-09 22:24 
QuestionGaussian Blur Effect Pin
Etienne_1239-Jun-09 6:50
Etienne_1239-Jun-09 6:50 
AnswerRe: Gaussian Blur Effect Pin
#realJSOP9-Jun-09 9:03
professional#realJSOP9-Jun-09 9:03 
AnswerRe: Gaussian Blur Effect Pin
Christian Graus9-Jun-09 10:51
protectorChristian Graus9-Jun-09 10:51 
AnswerRe: Gaussian Blur Effect Pin
Pete O'Hanlon9-Jun-09 23:06
mvePete O'Hanlon9-Jun-09 23:06 
GeneralRe: Gaussian Blur Effect Pin
Etienne_12310-Jun-09 3:49
Etienne_12310-Jun-09 3:49 
GeneralRe: Gaussian Blur Effect Pin
#realJSOP10-Jun-09 8:12
professional#realJSOP10-Jun-09 8:12 
QuestionNavigationEventArgs.Uri and LoadCompleted event Pin
Gary Wheeler9-Jun-09 5:32
Gary Wheeler9-Jun-09 5:32 
QuestionCopy Paste event handler at design time Pin
Vinod C S9-Jun-09 5:20
Vinod C S9-Jun-09 5:20 

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.