Loop through RadGrid and read Check Boxes when not in edit mode

by ebarcza 10/10/2017 8:17:00 AM

Step 1 - create a GridTemplate Column with a checkbox

 <telerik:GridTemplateColumn UniqueName="colCheckDelete" HeaderText="Delete">
                    <ItemTemplate>
                        <asp:CheckBox ID="chkDelete" runat="server" />
                   </ItemTemplate>

 </telerik:GridTemplateColumn>

Step 2 - The codebehind loop

foreach (GridDataItem item in rgDeals.MasterTableView.Items)
        {
            CheckBox chkDelete = (CheckBox)item["colCheckDelete"].FindControl("chkDelete");
            if(chkDelete.Checked)
            {
                //Delete the deal
                try
                {
                    int dealID = Convert.ToInt32(item.GetDataKeyValue("DealID"));
                    string sql = "Delete stuff where dealID = " + dealID;
                    int rslt = Utility.ExecuteNonQuerySQL(sql);
                }
                catch (IndexOutOfRangeException ex)
                {
                    //do nothing
                }
                catch (Exception ex)
                {
                    ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "CreateMasterAlert('alert alert-danger', '" + "One or More deletes failed" + "');", true);
                }
            }
        }
        rgDeals.Rebind();
        ScriptManager.RegisterStartupScript(this.Page, this.Page.GetType(), "alert", "CreateMasterAlert('alert alert-success', '" + "Delete Operation completed" + "');", true);

Tags:

.NET | SQL SERVER | Telerik

Cannot read keys when either application does not have a console or when console input has been redirected from a file. Try Console.Read.

by ebarcza 6/23/2017 9:58:00 AM
[No text]

Tags:

RadGrid Filter Case Sensitive

by ebarcza 11/11/2016 6:27:00 AM
GroupingSettings CaseSensitive = "false"

Tags: , ,

Windows Service Install System.Security.SecurityException

by ebarcza 12/7/2015 7:23:00 AM

An exception occurred during the Install phase. System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security.

 

To get around this issue, just right mouse click on the 

Tags:

Paypal button and .NET aspx page

by ebarcza 9/21/2015 12:59:00 PM

Paypal buttons don't work on aspx pages with a master page usually b/c of the embedded form tags. You can't have a form within a form.

Quick fix hack alert - Before the paypal code enter a closing form tag (This will close the asp pages form) then remove the closing form tag from the paypal code and allow the end of .net page end form tag to close the paypals form.

Tags:

View Server State permisssion was denied on object 'server', database 'master'

by ebarcza 9/1/2015 2:29:00 PM

I just ran into this error when creating a new user. Hope this helps somebody

 

Run this query in the master database

GRANT VIEW SERVER STATE TO username;

 

Tags:

Remove all objects from a SQL Schema - Cannot drop schema because it is being referenced by object

by ebarcza 9/1/2015 2:09:00 PM

IF you run into this error when trying to delete a schema(usually as a result of trying to delete a user that owns a schema)

"Cannot drop schema because it is being referenced by object"

 

First run this sql to generate the statements that will execute the move

SELECT 'ALTER SCHEMA dbo TRANSFER [' + SysSchemas.Name + '].[' + DbObjects.Name + '];'
FROM sys.Objects DbObjects
INNER JOIN sys.Schemas SysSchemas ON DbObjects.schema_id = SysSchemas.schema_id
WHERE SysSchemas.Name = 'upstreamgasmgmt'
AND (DbObjects.Type IN ('U', 'P', 'V'))

The previous sql statement will return a set of records like this

ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[GetReportPoints];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[mappingTest];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[vwPhysicalZones];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[PantoneStaging_MeasurementVolumes];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[tbl_Volumes_PantonTest];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[test];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[ReportLAUFWellhead];
ALTER SCHEMA dbo TRANSFER [upstreamgasmgmt].[November204BidWeek];

 

Copy and paste that result set into a query window and run it.

 

Now try and delete the schema again!

Tags:

Visual Studio - Command to collapse all sections of code?

by ebarcza 7/17/2013 1:22:00 PM
CTRL + M + O will collapse all.
 
CTRL + M + L will expand all.
 
CTRL + M + P will expand all and disable outlining.
 
CTRL + M + M will collapse/expand the current section.

Tags: ,

Visual Studio 2010

Pervasive drivers not showing up in ODBC

by ebarcza 7/3/2013 1:50:00 PM
I order to set up an ODBC connection to Pervasive SQL engine to grab some Sage 50/Peachtree data I had to use the odbc32.exe from the sysWOW64 folder. I hope this helps someone!

Tags:

Visual Studio Zoom

by ebarcza 7/3/2013 10:17:00 AM
Keyboard commands

You can use Control+Shift+Comma to zoom out and Control+Shift+Period to zoom in.

Tags:

Powered by BlogEngine.NET 1.5.0.7
Theme by Mads Kristensen

About the author

Name of author Author name
Something about me and what I do.

E-mail me Send mail

Calendar

<<  November 2017  >>
MoTuWeThFrSaSu
303112345
6789101112
13141516171819
20212223242526
27282930123
45678910

View posts in large calendar

Recent comments

Tags

Disclaimer

The opinions expressed herein are my own personal opinions and do not represent my employer's view in anyway.

© Copyright 2017

Sign in