DotNet Solution

  • Home
  • Asp.net
    • Controls
    • DataControl
    • Ajax
  • Web Design
    • Html
    • Css
    • Java Script
  • Sql
    • Queries
    • Function
    • Stored Procedures
  • MVC
    • OverView
    • Create First Application
  • BootStrap
    • Collapse Function

Wednesday, 20 July 2016

Numeric Value Validation Through JavaScript

  Unknown       06:15       Js       No comments    

Validate Only Numeric Value Enter In TextBox Using JavaScript function
Firstly Write Java Script Function in <head tag> in Asp.Net
After That Call Function <OnKeyPress > on TextBox
Ex.
<head>
<script type="text/javascript">
   var specialKeys = new Array();
   specialKeys.push(8); //Backspace
        function IsNumeric(e)
         {
                  var keyCode = e.which ? e.which : e.keyCode
                   var ret = ((keyCode >= 48 && keyCode <= 57) || specialKeys.indexOf(keyCode) != -1);
                   document.getElementById("error").style.display = ret ? "none" : "inline";
                    return ret;
          }
</script>
</head>

Call On TextBox
ex.
<table>
<tr>
<td> Employee Salary<td>
<td>:</td>
<td>
  <asp:TextBox ID="tbnEmpSalary" runat="server" MaxLength="12" onkeypress="return IsNumeric(event)"></asp:TextBox>
     <span id="error">* Input digits (0 - 9)</span>
</td>
</tr>
</table>

OutPut
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+

Saturday, 16 July 2016

Split Function in Sql Serever

  Unknown       03:31       No comments    

We Use This Function and Get Values .Values split With Comma Operator and Get Split Values

Ex.
CREATE function [dbo].[SplitPra]       
(       
 @list varchar(8000)       
)       
returns @t table        
(       
 Word varchar(MAX) not null,       
 Position int identity(1,1) not null       
)       
as begin       
  declare        
    @pos int,       
    @lpos int,       
    @item varchar(100),       
    @ignore varchar(100),       
    @dl int,       
    @a1 int,       
    @a2 int,       
    @z1 int,       
    @z2 int,       
    @n1 int,       
    @n2 int,       
 @n3 int,      
 @n4 int,     
 @n5 int,      
    @c varchar(1),       
    @a smallint       
  select        
    @a1 = ascii('a'),       
    @a2 = ascii('A'),       
    @z1 = ascii('z'),       
    @z2 = ascii('Z'),       
    @n1 = ascii('0'),       
    @n2 = ascii('9'),       
 @n3 = ascii('.'),     
 @n4 = ascii('-'),     
 @n5 = ascii(' ')     
  set @ignore = '''"'       
  set @pos = 1       
  set @dl = datalength(@list)       
  set @lpos = 1       
  set @item = ''       
  while (@pos <= @dl) begin       
    set @c = substring(@list, @pos, 1)       
    if (@ignore not like '%' + @c + '%') begin       
      set @a = ascii(@c)       
      if ((@a >= @a1) and (@a <= @z1))         
        or ((@a >= @a2) and (@a <= @z2))       
        or ((@a >= @n1) and (@a <= @n2))       
  or (@a=@n3) or (@a=@n4) or (@a=@n5)      
      begin       
        set @item = @item + @c       
      end else if (@item > '') begin       
        insert into @t values (@item)       
        set @item = ''       
      end       
    end        
    set @pos = @pos + 1       
  end       
  if (@item > '') begin       
    insert into @t values (@item)       
  end       
  return       
end


Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+

Values Enter With SplitFunction in Sql Server

  Unknown       03:28       StoredProcedures       No comments    


Basically We Use Split Function Thorugh Commma Sepertaed string value with  Comma  Means One Then more value through split function Enter and Fatch Single Values in A new Record

Ex.
Create procedure CommaSeperate                    
@st1 nvarchar(max),
str2 nvarchar(max)                 
AS                             
DECLARE    @i INT,@totaltran INT ,@st11 NVARCHAR(50),@str22 NVARCHAR(50)                   
SELECT @totaltran=dbo.fnCountOccurences(',',@str22)                             
SET @i=1                             
WHILE @i<=@totaltran                           
 BEGIN                
   SELECT @st11=a.Word,@str22=b.Word  FROM dbo.splitpra(@st1) a, dbo.splitpra(@str2)                           
nbsp;  WHERE a.position=@i AND b.position=@i                       
   SET @i=@i+1                        
   Execute Query And PRocedure                       
  
 END  
 SELECT @totaltran 

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+

Count Number Of Word In Sql Server

  Unknown       03:15       Function       No comments    

We Count HowMany Words Present in This String Through Function in Sql Server
Then Use This Code


CREATE FUNCTION fnCountOccurences     
               (@ShortString VARCHAR(100),     
                @LongString  VARCHAR(8000))     
RETURNS INT     
AS     
  BEGIN     
    DECLARE  @Text      VARCHAR(8000),     
             @Frequency INT     
         
    SET @Text = @LongString     
         
    SET @Text = REPLACE(@Text,@ShortString,'')     
         
    SET @Frequency = (len(rtrim(@LongString)) - len(rtrim(@Text)))     
                    / len(rtrim(@ShortString))     
         
    RETURN (@Frequency)     
  END

We Get OutPut:-

 SELECT[dbo].[fnCountOccurences](',','a,b,c,c,')
Execute
OutPut- 4
Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+

Friday, 15 July 2016

Reset Identity Column in Sql Server

  Unknown       02:11       Queries       1 comment    

We Want To Reset Identity Column Then Use Code.If We Delete column By Id Like We delete 5 no id and
After Than we Insert New then We get 6 no Id .We Show Data 1 to 4 id then 6 because 5 no id We Deleted Then Use Code and Get 5 id In Example-
Example-
SELECT * FROM vibha1<Table Name> --Here Vibha1 is TableName
We get Values-











Delete data  from table
Ex.
DELETE FROM vibha1 WHERE id=6
One Value Delete then Insert Value
INSERT INTO vibha1(name) VALUES('vibha1')

Get Values-










Then We Use Code
Syntax: DBCC CHECKIDENT( <TableName>, RESEED, <ValuesThen Start>)
And Delete id 7 record
DELETE FROM vibha1 WHERE id=7
Then  Execute This
 DBCC CHECKIDENT( vibha1 , RESEED, 5)
Then Insert
INSERT INTO vibha1(name) VALUES('vibha1')
Now Get Result

Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+

Saturday, 9 July 2016

Asp.net- MultiView

  Unknown       00:26       Controls       1 comment    

MultiView and View controls allow you to divide the content of a page into different groups, displaying only one group at a time. Each View control manages one group of content and all the View controls are held together in a MultiView control.
The MultiView control is responsible for displaying one View control at a time. The View displayed is called the active view.

The syntax of MultiView control is:
<asp:MultView ID= "MultiView1" runat= "server">
</asp:MultiView>
 
The syntax of View control is:
 <asp:View ID= "View1" runat= "server">
</asp:View> 

However, the View control cannot exist on its own. It would render error
 if you try to use it stand-alone. It is always used with a Multiview 
control as:
<asp:MultView ID= "MultiView1" runat= "server">
   <asp:View ID= "View1" runat= "server"> </asp:View>
</asp:MultiView> 
 
Properties
ActiveViewIndex- A zero based index that denotes the active view. If no view is active, then the index is -1.

Example-
 Aspx Source Code-
<table border="0" cellpadding="2" cellspacing="3" width="100%">
<tr>
<td>
<asp:LinkButton ID="lnkTab1" runat="server" OnClick="lnkTab1_Click">Tab1</asp:LinkButton></td>
<td>
<asp:LinkButton ID="lnkTab2" runat="server" OnClick="lnkTab2_Click">Tab2</asp:LinkButton></td>
<td>
<asp:LinkButton ID="lnkTab3" runat="server" OnClick="lnkTab3_Click">Tab3</asp:LinkButton></td>
</tr>
<tr>
<td colspan="3">
<asp:MultiView ID="MultiView1" runat="server">
<table width="100%" cellpadding="2" cellspacing="5">
<tr>
<td>
<asp:View ID="View1" runat="server">
Content 1 goes here</asp:View>
</td>
<td>
<asp:View ID="View2" runat="server">
Content 2 goes here</asp:View>
</td>
<td>
<asp:View ID="View3" runat="server">
content 3 goes here</asp:View>
</td>
</tr>
</table>
</asp:MultiView></td>
</tr>
</table

C# Code
protected void Page_Load(object sender, EventArgs e)
{
  if (!IsPostBack)
   {
   SetDefaultView();
   }
}
private void SetDefaultView()
{
MultiView1.ActiveViewIndex = 0;
}
protected void lnkTab1_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 0;
}
protected void lnkTab2_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 1;
}
protected void lnkTab3_Click(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = 2;
}

OutPut-







Read More
  • Share This:  
  •  Facebook
  •  Twitter
  •  Google+
Newer Posts Older Posts Home

Popular Posts

  • Auto Increment Id in Sql Server
    SQL server identity column values use in table Steps- Firstly Open-> Sql Server Create Table -> First Field Like ID Usually Autoi...
  • MVC Framework Architecture
    MVC Flow- MVC application takes place when certain request comes from the client. The diagram below shows the flow: Flow Steps ...
  • Create First MVC Application
    How to create MVC First simple application It is very easy to make application in mvc follow some steps and create first application ST...
  • Reset Identity Column in Sql Server
    We Want To Reset Identity Column Then Use Code.If We Delete column By Id Like We delete 5 no id and After Than we Insert New then We get 6...
  • Unicque Row Num and Same Rank in Sql server
     Use Of  Row_Number() ,Rank() function , Dense_Rank() Row_Number() This function will assign a unique id to each row returned from t...
  • Create Table
    Create Table In Sql Server Syntax- CREATE TABLE TableName ( ColumnName1  INT PRIMARY KEY IDENTITY, ColumnName2, ColumnName3 ) Ex.  C...
  • Email Validation In JavaScript
    We use Validation for Email  in Javascript like in above example <!DOCTYPE html> <html> <head> <script> fu...
  • Numeric Value Validation Through JavaScript
    Validate Only Numeric Value Enter In TextBox Using JavaScript function Firstly Write Java Script Function in <head tag> in Asp.Net ...
  • Asp.net- MultiView
    MultiView and View controls allow you to divide the content of a page into different groups, displaying only one group at a time. Each Vie...
  • The Evolution of MVC
    Microsoft had introduced ASP.NET MVC in .Net 3.5,since then lots of new features have been added.The following table list brief history of ...

Blog Archive

  • ▼  2016 ( 36 )
    • ►  February ( 1 )
    • ►  March ( 5 )
    • ►  April ( 1 )
    • ►  June ( 10 )
    • ▼  July ( 6 )
      • Asp.net- MultiView
      • Reset Identity Column in Sql Server
      • Count Number Of Word In Sql Server
      • Values Enter With SplitFunction in Sql Server
      • Split Function in Sql Serever
      • Numeric Value Validation Through JavaScript
    • ►  November ( 8 )
    • ►  December ( 5 )
  • ►  2017 ( 1 )
    • ►  January ( 1 )
Powered by Blogger.

Categories

  • Ajax
  • AllFunction
  • Controls
  • CreateApplication
  • css
  • Function
  • javascript
  • Js
  • over view
  • OverView
  • Queries
  • StoredProcedures

Text Widget

Sample Text

Pages

  • Home

Copyright © DotNet Solution | Powered by Blogger
Design by Vibha Acharya