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...

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()

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.

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

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

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

.

.

.

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???

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...

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...

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

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();
    }
    }

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

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

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

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???

Since There is only one control in for the cell(In my case the cell is CustAddress represented by Cells[2] where 2 is the number of the cell)..
So in here we are using only one control that is TextBox in my case...
So we are putting 0 over here...

hey dude that will be error because you can`t able to convert (or parse) string in to number because default button name button<count>