954,593 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Asp .net for beginners

Guys this thread is basically for the beginners who want to learn ASP.NET from the very beginning.. Plz give your valuable suggestions and kindly provide appropriate answers for the queries...

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 
Sub Button_Click(ByVal sender As Object, ByVal e As EventArgs)
        Dim btn As Button = CType(sender, Button)
        btn.Text = (Int32.Parse(btn.Text) + 1).ToString()
    End Sub


Kindly describe the line:

(Int32.Parse(btn.Text) + 1).ToString()
geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

Hi,

btn.Text returns a string even if you have an integer value in the button. So if you want to add one to that string, then you have to first convert the text to an integer. To convert a string to integer, you can use int32.Parse(). Once you get the integer, you add 1 and then convert this integer back to string using .ToString() method.

binoy.mathew
Newbie Poster
8 posts since Sep 2008
Reputation Points: 10
Solved Threads: 1
 

I cant get this why would we add 1 to this string by converting it into integer??? Plz explain...

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

have you tried clicking the button for which the code is written. See what is the result. I dont know under what context you have this code.. I am making some assumptions..Assumptions are,
1. you have a button on the form
2. the button has some integer as its text, may be 1, 2, 3 or whatever
3. When you click on the button, the buttons text should increase by one. so if you have 1 as buttons text then the button text should become 2 and again if you click it and then 3 and so on..

Hope this explains

binoy.mathew
Newbie Poster
8 posts since Sep 2008
Reputation Points: 10
Solved Threads: 1
 

Ya you are right actually i just skipped that part.. Thanx a lot bro..

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 
geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 
geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 
geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 
geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 
geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

Please see the above two images....
What code should i enter so that i could exit the form after clicking the button???
I am using C sharp..
Or is it possible to exit the browser when i click this exit button???

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

Guys got the Solution for this ...
We can close our form by including the following code :

btnexit.Attributes.Add("onclick", "window.close()");


Where btnexit is the name of my button...

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

My next question is how can i write a code for deleting a row using gridview

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
        GridViewRow row = GridView1.Rows[e.RowIndex];

         objCust.CustId = Convert.ToInt32(objCust.findCustId().Tables[0].Rows[0][0].ToString());

        objCust.DeleteNewUser();

        if (objCust.DeleteNewUser() == 1)
        {
            bindGvEdit();
        }
    }


But I am getting a error as

CS0019: Operator '==' cannot be applied to operands of type 'System.Data.DataSet' and 'int'

Plz suggest how to rectify...

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

I have written stored procedure for DeleteNewUser in Sql server 2005... I am using visual studio 2005 as well..

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

Actually Guys the problem was with the Bll; Which would look like:

public int DeleteNewUser()
    {
    DBAccess db = new DBAccess();
    db.AddParameter("@iCustId", iCustId);
    return db.ExecuteNonQuery("[tblCust_Delete]",true);
    }

and the modified code would be:

protected void GridView1_RowDeleting(object sender, GridViewDeleteEventArgs e)
    {
     
    GridViewRow row = GridView1.Rows[e.RowIndex];
     
    objCust.CustId = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);
     
    if (objCust.DeleteNewUser() > 0)
    {
    bindGvEdit();
    }
    }
geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

Guys I am marking this thread as Unsolved bcoz i want to make this thread a Discussion spot for all beginners like me who want to learn this language..
This thread is within top ten in google search list:
So I dont want to wrap it up lyk that...
Contributors plz contribute... Any question related to ASP.net and SQL SERVER is welcomed...

Regards,

Vishal Ranjan

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

I will be putting links to most useful study material for learning ASP.NET..

Guys plz make a note of it......

http://www.dotnetspider.com/AspNet-Tutorial-44.aspx ----- Dot Net Projects

http://www.w3schools.com/ ---- a very good website 4 learning many web-based languages

http://www.aspspider.com/tutorials/ --- Very good website for learning

http://webdesign.about.com/

http://www.sourcecodeonline.com/sources/asp_net.html -- Source codes for various asp.net appln

http://www.codeproject.com/ -- another website for source code related article

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

Plz Suggest more ideas to make it a better Discussion Space.....

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

I am having a doubt:
Consider the following code...

protected void GridView1_RowUpdating(object sender, GridViewUpdateEventArgs e)
    {
        GridViewRow row = GridView1.Rows[e.RowIndex];
        objCust.CustId = Convert.ToInt32(GridView1.DataKeys[row.RowIndex].Value);
        objCust.CustAddress = ((TextBox)row.Cells[2].Controls[0]).Text;
        objCust.UpdateNewUser();
        GridView1.EditIndex = -1;
        bindGvEdit();
    }


What does '0' in Controls[0] stands for???

geniusvishal
Junior Poster in Training
58 posts since Jan 2012
Reputation Points: 9
Solved Threads: 4
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
 
View similar articles that have also been tagged: