Another Salesforce blog!!!

Salesforce, Apex

ASP.NET

Lifecycle Hooks in Mounting Phase in LWC – Parent/Child

Life Cycle Parent Component: Life Cycle Child Component:

Template Looping in LWC

PageReference redirecting from the Visualforce page

if you are passing any parameters then you would use this: <apex:outputLink value=”{!URLFOR($Page.NewEmployee, null, [empId=e.Id])}”> e.Name </apex:outputLink> If you want to add more parameters, you can add them in between the square brackets. [empId=e.Id,id=URLENCODE($CurrentPage.Parameters.Id)]

How to get RecordType Id

/To get the recordType Id for Account – Record Type Name is “Person Account” //Get all the Record Types of Account and store it in a map. Map <String,Schema.RecordTypeInfo> recordTypes = Account.sObjectType.getDescribe().getRecordTypeInfosByName(); //Get the record type id of from the Map based on the Name Id RecTypeId = recordTypes.get(‘Person Account’).getRecordTypeId());

Check to see whether the file in a url Exists or Not

You can use HttpWebRequest. Note four things 1) The webRequest will throw exception if the link doesn’t exist 2) You may like to disable auto redirect 3) You may also like to check if it’s a valid url. If not, it will throw UriFormatException. 4) Per Paige suggested , Use “Head” in request.Method so that […]

Extract substring from a string until finds a comma c# asp.net

substring = str.Split(‘,’)[0]; or You can use IndexOf() to find out where is the comma, and then extract the substring. If you are sure it will always have the comma you can skip the check. string a = “asdkjafjksdlfm,dsklfmdkslfmdkslmfksd”; int comma = a.IndexOf(‘,’); string b = a; if (comma != -1) { b = a.Substring(0, […]

Convert foreach loop to Linq code

Converting this code to Linq: string[] selections = “Men,Women,Boys”.Split(‘,’); int _chkboxId = 0; int _chkboxTextId = 1; try { string id = “lstchk_” + _chkboxId; while (!driver.FindElement(By.Id(id)).Equals(null)) { string checkboxId = String.Format(“lstchk{0}”, _chkboxTextId); string checkboxName = driver.FindElement(By.Id(checkboxId)).Text; foreach (string match in selections) { if (checkboxName == match.Trim()) { //matched… do more work here… } } […]

Check-All checkbox using GridView (asp.net)

&lt;asp:CheckBox ID=”chkRejectAll” CssClass=”selectreject” runat=”server” onclick=”javascript:SelectAllRejectCheckboxes(this, ‘.selectreject’);” /&gt; //select reject all checkbox     function SelectAllRejectCheckboxes(chk, selector) {         $(‘#&lt;%=gv.ClientID%&gt;’).find(selector + ” input:checkbox”).not(‘checked’).each(function () {             $(this).prop(“checked”, $(chk).prop(“checked”));         }); } &nbsp;

How to grab the text inside the TextBox in ASP.NET using jQuery

   var _comment = $(“#[id*=’commentEdit’]”).val();  <asp:TextBox runat=”server” ID=”txtNewComments”  MaxLength=”300″ TextMode=”MultiLine” Rows=”7″ Width=”100%”></asp:TextBox>

How to restrict the user to allow only one checkbox of each checked? (ASP.NET)

<%@ Page Language=”C#” AutoEventWireup=”true” CodeBehind=”chkbox_checked_uncheked.aspx.cs”     Inherits=”Ediable_Repeater.chkbox_checked_uncheked” %> <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd“> <html xmlns=”http://www.w3.org/1999/xhtml“> <head runat=”server”>     <title></title>     <script src=”Scripts/jquery-1.6.2.min.js” type=”text/javascript”></script>     <script type=”text/javascript”>         $(document).ready(function () {             $(‘#C1All’).click(function () {                 $(‘.col1 > input’).attr(“checked”, $(‘#C1All’).attr(“checked”));                 $(‘.col2 > input’).removeAttr(“checked”);                 $(‘#C2All’).removeAttr(“checked”);             });             $(‘#C2All’).click(function () {                 […]

Previous Posts