Category: ASP.NET

PageReference redirecting from the Visualforce page

if you are passing any parameters then you would use this:

If you want to add more parameters, you can add them in between the square brackets.

Favorite

Read more

How to get RecordType Id

Favorite

Read more

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 […]

Read more

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.

or

or

Favorite

Read more

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… } } […]

Read more

Check-All checkbox using GridView (asp.net)

Favorite

Read more

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> Favorite

Read more

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 () {                 […]

Read more

Gridview itemTemplate enable/disable the dropdownlist based on the checkbox checked using jQuery

 <ItemTemplate>              <div>                 <asp:CheckBox CssClass=”selectme” ID=”chkReject” runat=”server” Checked=”false”>                 </asp:CheckBox>                 <asp:DropDownList runat=”server” ID=”detail” >                     <asp:ListItem Selected=”True” Value=”0″>Select me</asp:ListItem>                     <asp:ListItem Value=”1″>one</asp:ListItem>                     <asp:ListItem Value=”2″>two</asp:ListItem>                     <asp:ListItem Value=”3″>three</asp:ListItem>                     <asp:ListItem Value=”4″>four</asp:ListItem>                 </asp:DropDownList>             </div>         </ItemTemplate> protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e) {     var chk = e.Row.FindControl(“CheckBox1”) as CheckBox;     if […]

Read more