Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
R

Rajdev Ramasamy

@Rajdev Ramasamy
About
Posts
16
Topics
0
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Disable a button a web form.
    R Rajdev Ramasamy

    Hi, Are you using UpdatePanel? Thanks, Rajdev KR

    ASP.NET tutorial question

  • Problem With ModalPopupExtender and UpdatePanel
    R Rajdev Ramasamy

    It would be helpful if you show atleast some sample code. Thanks, Rajdev KR

    Web Development database help announcement

  • How to Add an UpdatePanel dynamically?
    R Rajdev Ramasamy

    We can add update panels dynamically. Please refer the following code sample(working): Note: This is a Sample code Aspx

    <%@ Page Language="C#" AutoEventWireup="true" CodeFile="DynamicUpdatePanel.aspx.cs" Inherits="DynamicUpdatePanel" %>

    <!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>Dynamic Update Panel</title>
    </head>
    <body>
    <form id="frmDynamicUpdatePanel" runat="server">
    <asp:ScriptManager ID="pageScriptManager" runat="server"></asp:ScriptManager>
    <asp:Panel ID="panelControls" runat="server">
    </asp:Panel>
    </form>
    </body>
    </html>

    .CS

    using System;
    using System.Collections;
    using System.Configuration;
    using System.Data;
    using System.Linq;
    using System.Web;
    using System.Web.Security;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using System.Web.UI.WebControls.WebParts;
    using System.Xml.Linq;

    public partial class DynamicUpdatePanel : System.Web.UI.Page
    {
    DataTable dtCountry;
    DataTable dtState;

    protected void Page\_Load(object sender, EventArgs e)
    {
        PopulateData();
        CreateControls();
    }
    
    protected void CreateControls()
    {
        UpdatePanel updatePanel = new UpdatePanel();
                
        DropDownList ddlCountry = new DropDownList();
        ddlCountry.ID = "ddlCountry";
        ddlCountry.Items.Add(new ListItem("-Select-", "-1"));
        ddlCountry.DataSource = dtCountry;
        ddlCountry.DataValueField = "CountryID";
        ddlCountry.DataTextField = "CountryName";
        ddlCountry.DataBind();
        ddlCountry.SelectedIndexChanged += ddlCountry\_SelectedIndexChanged;
        ddlCountry.Items.Insert(0, new ListItem("-Select-", "-1"));
        ddlCountry.AutoPostBack = true;
    
        DropDownList ddlState = new DropDownList();
        ddlState.ID = "ddlState";
        ddlState.Items.Insert(0, new ListItem("-Select-", "-1"));
        
        updatePanel.ContentTemplateContainer.Controls.AddAt(0, ddlCountry);
        updatePanel.ContentTemplateContainer.Controls.AddAt(1, ddlState);
    
        panelControls.Controls.Add(updatePanel);
    
    }
    
    protected void PopulateData()
    {
        dtCountry = new DataTable();
    
    ASP.NET help tutorial question announcement

  • i want call a javascript from serverside after a asynchronous post back
    R Rajdev Ramasamy

    Hi, This can be accomplished by using BeginRequest and EndRequest methods of PageRequestManager during asyncpostback. Sample:

    <script language="javascript" type="text/javascript">
    <!--
    var prm = Sys.WebForms.PageRequestManager.getInstance();
    prm.add_initializeRequest(InitializeRequest);
    prm.add_endRequest(EndRequest);
    var postBackElement;
    function InitializeRequest(sender, args) {
    postBackElement = args.get_postBackElement();
    }
    function EndRequest(sender, args) {
    if (postBackElement.id == 'cmdUpdate') {
    displayWindow();
    }
    }

    // -->
    </script>

    Hope this would be useful. Please revert back on any queries. Thanks, Rajdev KR

    Web Development question csharp javascript asp-net sysadmin

  • How to convert the datatable into JSON String
    R Rajdev Ramasamy

    You have to loop through the rows to format the data to JSON string. Let's consider an example that your datatable contains two columns: - FirstName - LastName then, the code might be: Note: - Am not giving the exact code

    protected function ConvertDataTableToJSON(byval dt as DataTable)
    Dim strJSON as string
    strJSON = "{"
    for each row as DataRow in dt.Rows
    strJSON = strJSON + "'firstName':" + "'" + row("FirstName") + "',"
    strJSON = strJSON + "'lastName':" + "'" + row("LastName") + "',"
    end for

         strJSON = strJSON + "}"
    
         return strJSON
    

    end function

    Hope this will be useful. Please refer the following link for JSON format: http://en.wikipedia.org/wiki/JSON[^] Thanks, Rajdev KR

    Web Development javascript json help tutorial announcement

  • Gridview PageIndexChanging event not being called when using an asp:UpdatePanel
    R Rajdev Ramasamy

    I can get the event called in my sample as you described. Can you display the code you are using? Thanks, Rajdev KR

    Web Development question

  • Delete Value from Cookie
    R Rajdev Ramasamy

    We cannot delete a cookie actually. But one thing we can do is like, we can set the expiry date of the cookie to prior date, so that the browser will remove the cookie when it access the cookie for the next time, since it is expired. Expiring the Cookie in Server Side:

    if (Request.Cookies["MyCookie"] != null)
    {
    HttpCookie myCookie = new HttpCookie("MyCookie");
    myCookie.Expires = DateTime.Now.AddDays(-1d);
    Response.Cookies.Add(myCookie);
    }

    <u>Expiring the Cookie in ClientSide Side:</u>

    <script type="text/javascript">
    <!--
    deleteCookie('MyCookie');
    // -->
    </script>

    Please reply on any doubts. Hope this will be usefull for you. Thanks, Rajdev KR

    ASP.NET question tutorial

  • Protect a webpage
    R Rajdev Ramasamy

    Hi, The following sample will help you out for the points 1 and 4 for sure. Please try this and reply.

    <html>
    <head>
    </head>

    <!-- To disable Print Screen feature -->
    <body onload=setInterval("window.clipboardData.setData('text','')",2) oncontextmenu="return false" onselectstart="return false">
    Test Text
    <!-- To disable right click in the web page -->

    <script language=JavaScript>
    function clickIE() {
    if (document.all) {
    return false;
    }
    }
    function clickNS(e) {
    if (document.layers||(document.getElementById&&!document.all)) {
    if (e.which==2||e.which==3) {
    return false;
    }
    }
    }
    if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
    document.onmousedown=clickNS;
    }
    else{
    document.onmouseup=clickNS;
    document.oncontextmenu=clickIE;
    }
    document.oncontextmenu=new Function("return false")
    </script>

    <!-- To Disable Text Selection -->

    <script>

    function disableselect(e){
    return false
    }

    function reEnable(){
    return true
    }

    //if IE4+
    document.onselectstart=new Function ("return false")

    //if NS6
    if (window.sidebar){
    document.onmousedown=disableselect
    document.onclick=reEnable
    }
    </script>

    </html>

    Thanks, Rajdev K R

    ASP.NET csharp javascript asp-net

  • Set Listbox scroll position after Postback
    R Rajdev Ramasamy

    Please check whether this link will be useful: http://forums.asp.net/p/1324500/2665985.aspx[^] Regards, Rajdev KR

    ASP.NET database tools question announcement

  • how to handle validation control manually?
    R Rajdev Ramasamy

    Please clear the validationsummary control on refresh Regards, Rajdev KR

    ASP.NET tutorial question

  • Tool to test webpage
    R Rajdev Ramasamy

    you can use dottrace profiler: www.jetbrains.com/profiler/[^] Regards, Rajdev KR

    Web Development performance question

  • Hyperlink in a TextBox - Possible?
    R Rajdev Ramasamy

    Hi, I have tried with a simple html page with a textbox control. On entering some url, and hitting on "Enter" key, a new window will open with the given url. Please check this will be useful for you. Sample Data: http:\\www.google.com Code: <html> <head> <title>Hypherlink in a textbox</title> </head> <body> <script language="javascript"> function ShowWindow(e,tstinput) { if(e.keyCode == 13) { if(tstinput.value !='') { window.open(tstinput.value); return null; } } return e.keyValue; } </script> <input type="input" style="text-decoration:underline;" onkeypress="return ShowWindow(event,this)" /> </body> </html> Regards, Rajdev KR

    ASP.NET question com help

  • How can I display an editable checkbox in a gridview
    R Rajdev Ramasamy

    Can you post the full definirion of the grid? Thanks, Rajdev KR

    ASP.NET question

  • HeaderText doesn't appear [modified]
    R Rajdev Ramasamy

    Hi, Please try this:

    asp:TemplateColumn
    <HeaderTemplate>
    <input type="checkbox" id="chkall" Text="Select All" />
    </HeaderTemplate>
    <ItemTemplate>
    <input type="checkbox" id="chk" runat="Server"/>
    </ItemTemplate>
    </asp:TemplateColumn>

    or:

    asp:TemplateColumn
    <HeaderTemplate>
    <table>
    <tr>
    <td>Select All</td>
    </tr>
    <tr>
    <td>
    <input type="checkbox" id="chkall" />
    </td>
    </tr>
    </table>
    </HeaderTemplate>
    <ItemTemplate>
    <input type="checkbox" id="chk" runat="Server"/>
    </ItemTemplate>
    </asp:TemplateColumn>

    Regards, Rajdev K R

    ASP.NET sysadmin help

  • Handling maxRequestLength errors in IIS6
    R Rajdev Ramasamy

    Hi, We have faced a similar issue and resolved it. Please find the instructions we followed to resolve. We have limited the upload size to 10MB and we are showing friendly message if the size exceeds. Please revert back if you still have the issue.Thanks. Root Cause of the Issue · IIS6 uses a new metabase property called UploadReadAheadSize when passing data to an ISAPI extension. This property is used to determine the maximum buffer size for the incoming request. The default size for this buffer is 48k · If UploadReadAheadSize is smaller than the content length, an HTTP 413error is returned, and the connection is closed to prevent deadlock. This causes the “Page cannot be displayed” error in IE Solution · Change the value of UploadReadAheadSize to a value larger than the content length · The following example shows how to set the value for UploadReadAheadSize to 200KB on the Web server cscript adsutil.vbs set w3svc/1/uploadreadaheadsize 200 Source http://technet.microsoft.com/en-us/library/cc737382.aspx http://blogs.msdn.com/jiruss/archive/2007/04/13/http-413-request-entity-too-large-can-t-upload-large-files-using-iis6.aspx Thanks, Rajdev

    ASP.NET sysadmin help question csharp asp-net

  • Handling maxRequestLength errors in IIS6
    R Rajdev Ramasamy

    Hi, please try to extend the maxrequestlength in web.config to 5MB or greater, you can extend upto 2 GB for a 2.0 application. Please revert back if the problem still exists. Thanks, Rajdev

    ASP.NET sysadmin help question csharp asp-net
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups