Protected Sub uxItemDetailGrid_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles uxItemDetailGrid.RowCommand
' We are checking against the "ADD"
If e.CommandName = "ADD" Then
Dim strName As String = DirectCast(uxItemDetailGrid.FooterRow.FindControl("strName"), TextBox).Text
Dim strEmail As String = DirectCast(uxItemDetailGrid.FooterRow.FindControl("strEmail"), TextBox).Text
Dim strRegistrationUserName As String = DirectCast(uxItemDetailGrid.FooterRow.FindControl("strRegistrationUserName"), TextBox).Text
Dim strBadgeName As String = DirectCast(uxItemDetailGrid.FooterRow.FindControl("strBadgeName"), TextBox).Text
Dim fltOrderAmount As String = DirectCast(uxItemDetailGrid.FooterRow.FindControl("fltOrderAmount"), TextBox).Text
if (strName = "" or strEmail = "" or fltOrderAmount = "") then
Bind()
else
Dim connectionString As String = ConfigurationManager.ConnectionStrings("SiteSqlServer").ConnectionString
Dim myConnection As New SqlConnection(connectionString)
Dim query As String = "INSERT INTO i2Integration_EventRegv45_Registration(intEventID,intRegistrationCount,strName,strEmail,fltOrderAmount,fltDiscountAmount,fltDiscountPercent,strPaymentMethodID,blnEmailSent,strRegistrationStatusID) SELECT e.intEventID,1,@strName,@strEmail,@fltOrderAmount,0,0,'Check',0,'cmp' FROM i2Integration_EventRegv45_Event e where (YEAR(e.dtmEvent) = '" + ddlYear.SelectedValue + "' AND MONTH(e.dtmEvent) = '" + ddlMth.SelectedValue + "') AND e.strTitle = '" + DroplistData.SelectedValue.Tostring + "' Order by e.dtmEvent"
Dim myCommand As New SqlCommand(query, myConnection)
'myCommand.Parameters.AddWithValue("@intEventID", intEventID)
'myCommand.Parameters.AddWithValue("@dtmEvent", dtmEvent)
'myCommand.Parameters.AddWithValue("@strTitle", strTitle)
myCommand.Parameters.AddWithValue("@strName", strName)
myCommand.Parameters.AddWithValue("@strEmail", strEmail)
myCommand.Parameters.AddWithValue("@fltOrderAmount", fltOrderAmount)
myConnection.Open()
myCommand.ExecuteNonQuery()
myConnection.Close()
' Checking if row type
if e.Row.RowType = DataControlRowType.DataRow Then
' find the label control
Dim lblPaymentMethod As Label = TryCast(e.Row.FindControl(lblstrPaymentMethodID), Label)
' get the cell where that label contains
Dim d As DataControlFieldCell = TryCast(lblPaymentMethod.Parent, DataControlFieldCell)
' to change the backcolor
d.BackColor = System.Drawing.Color.Blue
end if
End If
End Sub
|