Contact Me

Nirav Prabtani

Mobile : +91 738 308 2188

Email : niravjprabtani@gmail.com

Nirav Prabtani

Wednesday 16 July 2014

apply style to div like bubble chat

Apply style to div like bubble chat



try this.. Smile | :) 
 
.bubble 
{
position: relative;
width: 250px;
height: 120px;
padding: 0px;
background: #000000;
-webkit-border-radius: 10px;
-moz-border-radius: 10px;
border-radius: 10px;
}
 
.bubble:after 
{
content: "";
position: absolute;
top: -33px;
left: 182px;
border-style: solid;
border-width: 0 15px 33px;
border-color: #000000 transparent;
display: block;
width: 0;
z-index: 1;
}
 
 
<div class="bubble "></div>

How to show loading is in progress with the image using ajax


How to show loading is in progress with the image using ajax


 <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
 
 
  .divBackMain
        {
            z-index: 99;
            position: fixed;
            top: 0px;
            left: 0px;
            height: 100%;
            width: 100%;
            background-color: black;
            opacity: 0.4;
        }
        .divLoader
        {
            position: fixed;
            top: 50%;
            left: 50%;
            z-index: 100;
            margin-left: -110px;
            margin-top: -110px;
            width: 220px;
            background-image: url('http://2.bp.blogspot.com/-XTR-_X58BHo/UE-v8fIayII/AAAAAAAACMw/fu8ZxR57xUU/s1600/LoadingGIF.gif');
        }
        #DivLoaderContainer
        {
            display:none;
            }
 function UploadData() {
 
            $("#DivLoaderContainer").fadeIn(); //set fadeIn whenever ypu want to show loader
            $.ajax({
                type: "POST",
                url: "PageName.aspx/MethodName",
                contentType: "application/json;charset=utf-8",
                data: {}, //Parameters
                dataType: "json",
                success: function (data) {
 
                    $("#DivLoaderContainer").fadeOut(); //set logout after finish all process 

 
                },
                error: function (result) {
 

 
                }
            });
 
 <div id="DivLoaderContainer">
            <div class="divBackMain">
            </div>
            <div class="divLoader">
                <img src="http://2.bp.blogspot.com/-XTR-_X58BHo/UE-v8fIayII/AAAAAAAACMw/fu8ZxR57xUU/s1600/LoadingGIF.gif" />
            </div>
        </div>

I have set visible using $("#DivLoaderContainer").fadeIn(); before ajax call
and after completion of ajax call it should be disappear using $("#DivLoaderContainer").fadeOut();
you can set fadeIn and fadeOut as per your need.. :)

How Do I Automatically Get Pc Name In Connection String


How Do I Automatically Get Pc Name In Connection String


try this.. Smile | :) 
 
System.Net.Dns.GetHostName();

or
System.Environment.GetEnvironmentVariable("COMPUTERNAME");
 
gives you current pc name.. Smile | :) 
 

 SqlConnectionStringBuilder connectionString = new SqlConnectionStringBuilder();
     connectionString.DataSource = System.Net.Dns.GetHostName();
     connectionString.InitialCatalog = "MyDatabase";
     connectionString.IntegratedSecurity = true;
    

How to automatically resize iframe from inside the iframe?


How to automatically resize iframe from inside the iframe?


Call that function of parent page from child page like that,
if you have function having name ReSize for resize iframe in parent page than you can call it from child page with top clause in javascript like that
 
Parent page function
 
function ReSize()
{
 
//Do stuff for iframe resize

} 
 

Child page function.
 
$(document).ready(function(){
 
top.ReSize(); //it will call main parent page function from child page.

});

There is no row at position 1


how to Solve " There is no row at position 1. "



your datatable doesn't contains any Rows in it, thats why that error occurs,
to prevent it always use condition to check like that
if(dt.Rows.Count>0)
{
//Do youe Stuff
}
 
1) Debug your code
2) Check is there any rows in your table DBCUSTOMERMASTER

how to apply text box value to label using javascript?


how to apply text box value to label using javascript?


try onkeypress event of textbox.. Smile | :) 
 
function settext(valueData)
{
  
    document.getElementById('<%=Label6.ClientID%>').innerHTML = valueData;
}
 
HTML
 
<asp:textbox id="txtbox1" runat="server" onkeypress="settext(this.value)" >
</asp:textbox>

Remove empty rows from Dataset


Remove empty rows from Dataset


try this.. Smile | :) 


DataSet ds = new DataSet();
 
                for (int i = 0; i < ds.Tables.Count; i++)
                { 
                      for (int j = 0; j < ds.Tables[i].Rows.Count; j++)
                    {
                        if (Convert.ToString(ds.Tables[i].Rows[j]["ColumnName"]) == string.Empty)
                        {
                            ds.Tables[i].Rows[j].Delete();
                        
                        }
                    }
                
                }

i have created this snippet without testing of it, so modify it according to your need.

Insert , Update, Delete list of items in cookies.

Insert , Update, Delete list of items in cookies.


add values to cookies in C#

HttpCookie cookie = new HttpCookie("mybigcookie");
cookie.Values.Add("name", name);
cookie.Values.Add("address", address);

delete cookies item in C#

Response.Cookies["CoockieName"].Values["itemIndex"] = String.Empty;
 


How Can I Split A String In Vb.Net

How Can I Split A String In Vb.Net


  Dim FileName As String = Path.GetFileName("~/photos/consultant/images.jpeg")

How to use insertion and deletion of row using stored procedure.

How to use insertion and deletion of row using stored procedure.


try operational stored procedure.
You have to declare variable @operation with int datatype like as shown below,
Now you can execute perticular query with just passing @operation from backend.
 
You can put both query in one operation as you wish.
You can execute multiple operations with this query.... Smile | :) 

CREATE PROCEDURE SP_MyQuery
     @ItemCode VARCHAR(50)=''
    ,@ItemDescription VARCHAR(250)=''
    ,@ItemCategoryID INT=0
,@ItemID INT=0
,@operation int=0
AS
BEGIN
IF(@operation=1)
begin
--What ever you want to execute, insert query , update query , delete query, select query
end
ELSE IF(@operation-2)
BEGIN
--What ever you want to execute, insert query , update query , delete query, select query
END
END

Send Sms from ASP.NET using Full On Sms

Send Sms from ASP.NET using Full On Sms


1) HTML

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>
<!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 id="Head1" runat="server">
    <title>Send Sms</title>
</head>
<body>
    <form id="form1" runat="server">
    <div>
        <asp:Label ID="Label1" runat="server" Text="Mobile No"></asp:Label>    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
        <br />
        <asp:Label ID="Label2" runat="server" Text="Message"></asp:Label>
        &nbsp;&nbsp;
        <asp:TextBox ID="TextBox2" runat="server" TextMode="MultiLine"></asp:TextBox>
        <br />
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <asp:Button ID="Button1" runat="server" Text="Send Sms"
            onclick="Button1_Click" />            
    </div>
    </form>
</body>
</html>


2) C#

using System;
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;
using System.Net;
 
public partial class _Default : System.Web.UI.Page
{
 
    string uid;
    string password;
    string message;
    string no;
 
    protected void Page_Load(object sender, EventArgs e)
    {
    }
   //This is the code of API for sending message.
    public void send()
    {
        HttpWebRequest myReq = (HttpWebRequest)WebRequest.Create("http://ubaid.tk/sms/sms.aspx?uid=" + uid + "&pwd=" + password + "&msg=" + message + "&phone=" + no + "&provider=fullonsms");
        HttpWebResponse myResp = (HttpWebResponse)myReq.GetResponse();
        System.IO.StreamReader respStreamReader = new System.IO.StreamReader(myResp.GetResponseStream());
        string responseString = respStreamReader.ReadToEnd();
        respStreamReader.Close();
        myResp.Close();
    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        try
        {
            uid = "";
            password = "";
            message = TextBox2.Text;
            no = TextBox1.Text;
            send();
            TextBox2.Text = "";
            TextBox1.Text = "";
        }
        catch (Exception ex)
        {
            ex.Message.ToString();
        }
    }



How to get Friday dates in a Month sql

How to get Friday dates in a Month


try this.. Smile | :) 

declare @DateFrom datetime,@DateTo datetime
set @DateFrom='23 Mar 2014'
set @DateTo='26 Jun 2014'
 
;WITH CTEQuery AS (
 SELECT CAST(@DateFrom AS DATETIME) AS dt
 UNION ALL
 SELECT DATEADD(dd, 1, dt)
  FROM CTEQuery s
  WHERE DATEADD(dd, 1, dt) <= CAST(@DateTo AS DATETIME)
  ),sampleData as(
select dt,datename(WEEKDAY,dt)as [DayName] from CTEQuery )
select * from sampleData where [DayName]='Friday'

you have to just pass @DateFrom and @DateTo from code behind and you will get all friday dates between there dates.. Smile | :)

How to set online image to Picturebox in windows form

Give URL to picturebox



pictureBox1.Load("http://www.dotnetperls.com/favicon.ico");

For more info: