Friday, October 19, 2018

Desktop Sharing

AeroAdmin

Listbox count program

protected void Button3_Click(object sender, EventArgs e)
    {
       

        if (DropDownList1.Items.Count > 1)
        {

            if (DropDownList1.SelectedIndex >= 15)
            {

            }
            else
            {
                DropDownList1.SelectedIndex = DropDownList1.SelectedIndex + 1;
            }


  }

Auto Generate Number Gridview


         <asp:TemplateField HeaderText="Sno">
         
        <ItemTemplate>
             <%#Container.DataItemIndex+1 %>
        </ItemTemplate>
    </asp:TemplateField>

Thursday, October 11, 2018

Manage Linkbutton inside Gridview

Aspx  Design



  <asp:TemplateField HeaderText="Reviewer Report" ItemStyle-CssClass="hs1" ItemStyle-Width="20px">

 <ItemTemplate> 
                 
<asp:ImageButton ID="lnk_report" runat="server" Visible="false"    CommandName="Select" ImageUrl="../images/editicon.png" OnClick="lnk_report_click"  />

  </ItemTemplate>
   </asp:TemplateField>



c#  code

protected void report()
    {

        //report button activation code

        string statusname;
        string cs = ConfigurationManager.ConnectionStrings["key"].ToString();
        cn = new SqlConnection(cs);
        cn.Open();

        foreach (GridViewRow r1 in dgvGrid.Rows)
        {
            dr.Close();

             Label lbid = (Label)r1.FindControl("LBLID");

             ImageButton lnk1 = (ImageButton)r1.FindControl("lnk_report");
           

             string k = "select * from table  where ID='" + lbid.Text + "'";
            cmd = new SqlCommand(k, cn);
            dr = cmd.ExecuteReader();
            while(dr.Read())
            {

                statusname = dr[6].ToString();

                if (statusname == "APPROVE")
                {

                    lnk1.Visible = true;
                }
             

            }
       


        }
        dr.Close();





    }

Tuesday, October 9, 2018

Create director on Run Time

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.IO;
public partial class rundirectory : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)// create
button show
    {
        Directory.CreateDirectory(Request.MapPath(TextBox1.Text) + "/");
        ListBox1.Items.Add(TextBox1.Text);
    }
    protected void Button2_Click(object sender, EventArgs e)//file uplad
    {
        FileUpload1.SaveAs(Server.MapPath("~")+"//"+ListBox1.Text+"//"+FileUpload1.FileName);
        Image1.ImageUrl = "~/" + ListBox1.Text + "/" + FileUpload1.FileName;
    }

}

Live Visitor Count on website

create globle.asx file

<%@ Application Language="C#" %>

<script runat="server">

    void Application_Start(object sender, EventArgs e)
    {
        // Code that runs on application startup

        Application["hitcount"] = 0;

    }

    void Application_End(object sender, EventArgs e)
    {
        //  Code that runs on application shutdown

    }

    void Application_Error(object sender, EventArgs e)
    {
        // Code that runs when an unhandled error occurs

    }

    void Session_Start(object sender, EventArgs e)
    {
        // Code that runs when a new session is started
        int n;
        n = (int)Application["hitcount"];
        n = n + 1;
        Application["hitcount"] = n;


    }

    void Session_End(object sender, EventArgs e)
    {
        // Code that runs when a session ends.
        // Note: The Session_End event is raised only when the sessionstate mode
        // is set to InProc in the Web.config file. If session mode is
set to StateServer
        // or SQLServer, the event is not raised.

        int n;
        n = (int)Application["hitcount"];
        n = n - 1;
        Application["hitcount"] = n;

    }

</script>




How to call visitor


using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

public partial class currentcount : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {
       //actual browsers open count(visiters)
        Label1.Text = "Number of Users is to be visited:=   " +
Application["hitcount"];

    }
}

Auto Redirect Page

Auto Redirect Page

<head runat="server">
  

    <meta http-equiv="refresh" content="2; URL=http://www.facebook.com"/>


    <meta name="keywords" content="automatic redirection"/>


   
</head>

GRIDVIEW PAGINING

  <asp: GridView ID="GridView1" runat="server"            AutoGenerateColumns="False"  AllowPaging="T...