Monday, January 7, 2019

Gridview CSS

<STYLE>

.allcaps
         {
              text-transform:capitalize;
           
          }
       
         .allcaps1
         {
              text-transform : uppercase;
          }

</STYLE>

 <asp:BoundField DataField="company" HeaderText="Company Name"

   ItemStyle-CssClass="allcaps">


IF CONTROL
CSSCLASS="CSSNAME"


Friday, January 4, 2019

Gridview popup create using ajax

Create Assembly 

<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1"

Create  CSS  Popup

 <style type="text/css">
       
   
       
        .modalPopup1
         {
            background-color : #87BEE1;
       
            padding: 10px 0px 10px 0px;
            padding-left: 10px;
            width: 50px;
            height :auto;
        }
   
        .modalBackground
        {
            background-color: Black;
            filter: alpha(opacity=40);
            opacity: 0.4;
        }
        .modalPopup
        {
            background-color: #FFFFFF;
            width: 400px;
            border: 3px solid  #666666;
        }
        .modalPopup .header
        {
            background-color:  #666666;
            height: 30px;
            color: White;
            line-height: 30px;
            text-align: center;
            font-weight: bold;
        }
        .modalPopup .body
        {
            min-height: 50px;
            line-height: 30px;
            text-align: center;
            padding:5px
        }
        .modalPopup .footer
        {
            padding: 3px;
        }
        .modalPopup .button
        {
            height: 23px;
            color: White;
            line-height: 23px;
            text-align: center;
            font-weight: bold;
            cursor: pointer;
            background-color: #9F9F9F;
            border: 1px solid  #666666;
        }
   
    </style>


Script to  close popup


    <script type="text/javascript">
        function pageLoad(sender, args) {
            if (!args.get_isPartialLoad()) {
                //  add our handler to the document's
                //  keydown event
                $addHandler(document, "keydown", onKeyDown);
            }
        }

        function onKeyDown(e) {
            if (e && e.keyCode == Sys.UI.Key.esc) {
                // if the key pressed is the escape key, dismiss the dialog
                $find('addAttribute1').hide();
                //$find('editAttribute1').hide();

            }
   


        }
    </script>

create  click  event 





 protected void lnk_report_click(object sender, EventArgs e)
    {
        //REVIEWER  report  panel 

      

        GridViewRow clickedRow = ((ImageButton)sender).NamingContainer as GridViewRow;
        Label lblID = (Label)clickedRow.FindControl("LBLID");
        Label lblemail = (Label)clickedRow.FindControl("Label10");
        Label lblname = (Label)clickedRow.FindControl("auname");

        Label8.Text = lblID.Text;
        Label11.Text = lblemail.Text;
        Label12.Text = lblname.Text;
        Button2.Visible = false;


        var closeLink = (Control)sender;
        GridViewRow row = (GridViewRow)closeLink.NamingContainer;
        Label9.Text = row.Cells[3].Text; // here we are




        foreach (GridViewRow r1 in GridView1.Rows)
        {


            if (r1.Cells[3].Text == "APPROVE")
            {
                Button2.Visible = true;

            }
           
         
        }


        ModalPopupExtender2.Show();
        panelassign.Visible = false;
        panelrev.Visible = true;



    }

Thursday, January 3, 2019

confirm on button click event

<asp:Button ID="btndelete" runat="server"     OnClientClick="javascript:return confirm('Are you sure you want to delete?');"   Text="Delete" Width="106px" onclick="btndelete_Click" Enabled="False"    Visible="False"  />

Wednesday, December 26, 2018

Autogenerate ID

using System.Configuration;
using System.Data;
using System.IO;


protected void generatedStudID()
    {
        con.Open();

        cmd = new SqlCommand("select MAX(Sr_No) from  TABLENAME", con);

   
        int i = Convert.ToInt32(cmd.ExecuteScalar());
        con.Close();
        i++;
        strID = ID + Year + z + i.ToString();


    }

Saturday, December 15, 2018

Solve DNS NOT Found problem in local system

1. Go to control panel

2. Click here Network and sharing center

3. Click Access Type Local Area Connection

4.Go to property

5. Select  4( TCP / IPV4 )

6. Set DNS 

                      8    8  8  8
                      8    8  4  4

Sunday, December 9, 2018

CHECL IMAGE URL IS NULL OR NOT

 <div id="Div1" runat="server" visible='<%# Eval("pic") != DBNull.Value %>'>
 
  <asp:Image ID="Image1"     ImageUrl='<%# "/pic/" + Eval("pic") %>' runat="server" style="height:355px; width: 486px;"></asp:Image>

  </div> 

Blog code in asp.net c#

ASPX CODE

 <style>
* {
    box-sizing: border-box;
}

/* Add a gray background color with some padding */
body {
    font-family: Arial;
    padding: 20px;
    background: #f1f1f1;
}

/* Header/Blog Title */
.header {
    padding: 30px;
    font-size: 40px;
    text-align: center;
    background: white;
}

/* Create two unequal columns that floats next to each other */
/* Left column */
.leftcolumn { 
    float: left;
    width: 75%;
}

/* Right column */
.rightcolumn {
    float: left;
    width: 25%;
    padding-left: 20px;
}

/* Fake image */
.fakeimg {
    background-color: #aaa;
    width: 100%;
    padding: 20px;
}

/* Add a card effect for articles */
.card {
     background-color: white;
     padding: 20px;
     margin-top: 20px;
}

/* Clear floats after the columns */
.row:after {
    content: "";
    display: table;
    clear: both;
}

/* Footer */
.footer {
    padding: 20px;
    text-align: center;
    background: #ddd;
    margin-top: 20px;
}

/* Responsive layout - when the screen is less than 800px wide, make the two columns stack on top of each other instead of next to each other */
@media screen and (max-width: 800px) {
    .leftcolumn, .rightcolumn { 
        width: 100%;
        padding: 0;
    }
}
</style>





   <div class="container bgwhite" style="border-top: 10px solid #4f6584;">
      <div class="row"  style="padding: 50px 0 30px 0;" >
   
 <div class="card">



   
         <asp:Repeater ID="Repeater1" runat="server">
   
    <ItemTemplate >   

      <h2> <asp:Label ID="Label2" runat="server" Text='<%# Eval ("title") %>' style="width: 486px;"></asp:Label></h2><br /> 


       <div id="Div1" runat="server" visible='<%# Eval("pic") != DBNull.Value %>'>
 
  <asp:Image ID="Image1"     ImageUrl='<%# "/pic/" + Eval("pic") %>' runat="server" style="height:355px; width: 486px;"></asp:Image>

  </div> 


      <br />

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

   <hr />
 
    </ItemTemplate>

    </asp:Repeater>


     </div>
 </div></div>



CS CODE


       SqlCommand cmd = new SqlCommand("select * from TABLE ORDER BY id  DESC ", con);
            DataSet ds = new DataSet();
            SqlDataAdapter da = new SqlDataAdapter(cmd);
            da.Fill(ds);
            Repeater1.DataSource = ds;
            Repeater1.DataBind();
         
               














GRIDVIEW PAGINING

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