Sunday, 17 August 2014

How To Get Viewstate Value From One Page To Another Page In Asp.Net

Hello Everyone,

Now I am tell you about viewstate. to get value of viewstate from another page using StateBag Class.

Lets example there is two page 1) First.aspx 2) Second.aspx
where we set viewstate value in First.aspx on some button click and then redirect to Second.aspx where we get value of viewstate which we set in Frist Page.


1) Button Click in First.aspx (.cs file Code)

protected void button_Click(object sender, EventArgs e)
    {
        
           // Set Viewstate Value
               
          ViewState["Name"] = "Chetan" ;

          Server.Transfer("Second.aspx");


     }

Wednesday, 23 January 2013

Allow Only One Checkbox to be Checked From Group Of CheckBox In Asp.Net


Hello Everyone now I am Explaining to you that if you have group of check box in your page. your requirement is to check only one check box from the group And unchecked the other then for that i am providing one javascript function that is completed your requirement.
JAVASCRIPT CODE ARE :
 $(document).ready(function() {
        

Friday, 21 December 2012

Post Data Using Response.Redirect In Asp.net


Hello Every one after long time I am back with new Post that is you Post Data Using Response.Redirect in your application. Nowdays I am creating a application on which I needed to communicate with a third party payment application, where in some point, I will have to send information to that third party application using POST.
we are not using GET method because it contain secure value.

In Our asp.net there some options for submitting data(POST or GET) to a destination URL: They Are As follow:

Response.Redirect: This method is commonly used, but it will only use the GET method in ASP.NET, and there is no way to do a POST using it.

Server.Transfer: This method does a POST not GET, but ... unfortunately, it will only work when the source and destination are in the same application;

HTML Submit button with POST FORM: Well, this is the standard way of sending POST data to any URL, whether it is in your application or in a third party application, but this will restrict you to have a Submit button.

Now I have a Response.Redirect method to which give a collection of data and to do a POST method instead of a GET method

Friday, 12 October 2012

Bind Menu Control With Database In Asp.Net


Hello guys Now Explaining You how you bind menu control in asp.net
with value which coming from database.
Let Consider that you have database contain two table 1st table Contain menu detail they are as follow 1) Menu ID
2)Menu Name
3)Menu Value
4)Navigate URL
5)Parent ID
2nd table is Menuid and userRole Mapping table contain following 1) Menu ID
2) Role

Now As per role you can get the menu Datatable from database by writing query for that lets see we have datatable wchich contain menu information.
now front side we have one menu item control as
 
    
    
  
 

on server side write following code in pageload method
 dtMenu = GetMenu(Session["Role"].ToString()); //this is datatable

//which contain information menu which you want to bind for that userrole
  ShowMenu(NavigationMenu.Items, 0); 

now here is ShowMenu Method

Wednesday, 3 October 2012

MICROSOFT.ACE.OLEDB.12.0 Provider is not register on local machine

Hello Guys,
I developed an internal application with asp.net 2010, it creates oledb connection and opens excel file.
 I started the coding when I had office 2007, when other people tried to install it on their machines, these with office 2007 would be fine but these with office 2010 would get error message
 "The 'Microsoft.Ace.OLEDB.12.0' provider is not registered on the local machine".

Then I found Following Solution For Above Problem

It Will solved in Following Steps

STEP 1 )
Download Following Files
                1)Acess Database Engine.exe
                 2)AccessDatabaseEngine_x64.exe

Sunday, 30 September 2012

Disable Copy Paste In Textbox In Asp.Net


If we want to allow users to use right click to copy paste or by using ctrl+C , ctrl+v in textbox on a aspx page in asp.net, To disable this we can use javascript
we can achieve this in 2 ways
use Following method If u don't want any alerts or message




If you want to show alerts than use Following method
Right this javascript function in the head section of aspx page, in this function we are disabling right mouse click and ctrl keys

Untitled Page



Wednesday, 26 September 2012

sql interview questions


Hello Every one, This post demonstrates some commonly asked SQL queries in a job interview. I will be covering some of the common but tricky queries like:-
*) Finding the nth highest salary of an employee.
Create a table named SqlTest and insert some test data as:-
CREATE TABLE SqlTest
(
ID INT Identity,
Name Varchar(100),
Sal Decimal (10,2)
)

INSERT INTO SqlTest VALUES ('Chetan',1000);
INSERT INTO SqlTest VALUES ('Shilpa',1200);
INSERT INTO SqlTest VALUES ('Surya',1100);
INSERT INTO SqlTest  VALUES ('Kanchan',1300);
INSERT INTO SqlTest  VALUES ('Amit',1400);


First We Find Highest Salary To find the highest salary as
--Find  Highest Salary
select max(Sal) from SqlTest