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>

Sunday, October 7, 2018

Display Gridview Cell Value on Button click event

 <asp:TemplateField HeaderText="Assign Reviewer" ItemStyle-CssClass="hs1" ItemStyle-

   Width="20px">

               <ItemTemplate> 


                   <asp:ImageButton ID="lnk_Update" runat="server"   CommandName="Select"

                    ImageUrl="../images/editicon.png"  OnClick="lnk_Update_Click" />

   </ItemTemplate>
   </asp:TemplateField>



C#  Code

  protected void lnk_Update_Click(object sender, EventArgs e)

    {

         var closeLink = (Control)sender;

        GridViewRow row = (GridViewRow)closeLink.NamingContainer;


        Label5.Text  = row.Cells[5].Text; // here we are


}

Monday, October 1, 2018

Gridview Linkbutton Event without using SelectedIndexChanged Event

Setting following Property in Gridview 

 <asp:GridView ID="dgvGrid" runat="server"  CssClass="mydatagrid" HeaderStyle-

   BackColor="#EEEEEE"  Width="100%" AutoGenerateColumns="False">


 <asp:TemplateField HeaderText="Edit" ItemStyle-CssClass="hs1" HeaderStyle-CssClass="header-center">
 
 <ItemTemplate>

    <asp:LinkButton ID="linkEdit" runat="server"    Text="Edit"  OnClick="linkEdit_Click"/>


  </ItemTemplate>
  </asp:TemplateField>


 Add  label  with Database Column 

 <asp:TemplateField HeaderText="Paper ID" ItemStyle-CssClass="hs1" HeaderStyle-CssClass="header-center">
                    <ItemTemplate>

                      <asp:Label ID="LBLID" runat="server" Text='<%# Eval("ID") %>'></asp:Label>

                     
                    </ItemTemplate>
                </asp:TemplateField>



C#   Code  Link button Event



 protected void paybtn_Click(object sender, EventArgs e)
    {

        GridViewRow clickedRow = ((LinkButton)sender).NamingContainer as GridViewRow;
        Label lblID = (Label)clickedRow.FindControl("LBLID");
        lblJ_ID.Text = lblID.Text;
     
         Session["paperid"] = lblJ_ID.Text;
        Response.Redirect("payment1.aspx");       
     

    }









GRIDVIEW ON ROW DATA BOUND EVENT

 Database Create  Student : roll , name , city , cost  Fix 6 Value  in Database Record  ====================================================...