CrappyCoder 22 Light Poster

Any particular reason you want to set the timeout to an arbitary value of 200 or do you just want the session variables to remain indefinately?

If its indefinately then check that the user has been authenticated and populate the session variables accordingly

CrappyCoder 22 Light Poster

Why don't you just hide it and iterate through the grid for the hidden rows?

e.g to hide the row on 'deleting'

protected void gd_OnRowDeleting(object sender, GridViewDeleteEventArgs e)    
{
    gd.Rows[e.RowIndex].Visible=false;
}

Now iterate through the Gridview looking for the hidden rows

foreach (GridViewRow gvr in gd.Rows)
{
  if (gvr.Visible==false)			
  {
    some process...
    or         
    Debug.Print(gvr.RowIndex.ToString());
  }
}

I have tried it and it does work...

CrappyCoder 22 Light Poster

I think you've misunderstood what you should be doing:

This is how it should be done...

protected void gd_OnRowDeleting(object sender, GridViewDeleteEventArgs e)    {            
... Delete from Database
gd_Subjects.DataSource = DatabaseQuery;            
gd_Subjects.DataBind();     

}

Otherwise you will always have a false reading as the row will only be deleted from the UI and not the database.

CrappyCoder 22 Light Poster

Hmmm,

I assuming that the 'other machine' is your web server and you've loaded the images to the relevant directory on that server but you are now working on a local machine and cannot find the images.

Or have I got it completely wrong?

CrappyCoder 22 Light Poster

Nitin Daphale: Not actually sure what you're trying to do - presumably the row deleting event is being fired because you are trying to delete the row?

So why do you need to remove the row programatically as the inbuilt delete function will take care of this - do you have more than one delete buttons?

Tell us abit more about your program design and we may be able to offer further assistance

CrappyCoder 22 Light Poster

Visual Studio is the Development Envrionment and C# is the programming language.

Normally you would use the ViewState object to save page-specific information and the Session object to save Site-specific information.

//Page Specific 
ViewState["UrlReferrer"] = Request.UrlReferrer.ToString();   
ViewState["ValueEntered"] = TextBox1.Text;  


//Website specific
Session["UserName"] = "JohnThomas";
CrappyCoder 22 Light Poster

The only issue you will have is ensuring you can update the tables in your database using the logged-in user's identity (which is GUID based)

Otherwise the memebrship/roles will do nearly everything you need.

Be advised that the Membership data resides in your App_Data folder unless you specifically point to an external database - A few people I know have overwritten this membership data in a production environment when they FTP a new release of their web application with the local membership data

CrappyCoder 22 Light Poster

What language are you using for your code behind?

CrappyCoder 22 Light Poster

Hmmm,

Not a good idea to get the Max(IDColumnName) as previously suggested it will only get the last inserted record (not the record you have added) - and in a high transactional database you will get totally incorrect results.

Much better to return the ID added within the scope of the insert procedure which is why its preferable to use SCOPE_IDENTITY and assumes you have added an auto-incrementing Identity column in your database (if not why not?)

You have several methods to retrieve the Identity value depending on your knowledge.

You could use a dataset to return a column value (example shown), or you could use RETURN SCOPE_IDENTITY at the end of your procedure or you could include an OUTPUT parameter in your argument declaration:

BEGIN

INSERT INTO <TABLE>....
(Field1, Field2...)
VALUES
(Value1, Value2...)

SELECT [InsertedRecordID] = SCOPE_IDENTITY

END

ALternatively you could use

Using conn As New SqlConnection(connString)
Dim cmd As New SqlCommand(sql, conn)
...
...
...

int InsertedRecordID = (int)cmd.ExecuteScalar();

:

You would then need to change your SQL code...

BEGIN

INSERT INTO <TABLE>....
(Field1, Field2...)
VALUES
(Value1, Value2...)

RETURN SCOPE_IDENTITY

END

But please do NOT use the SELECT MAX() method!!!!