Loading ...

Create/insert data via detailsview to gridview in a web service

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  data access   » Create/insert data via detailsview to gridview in a web service

Create/insert data via detailsview to gridview in a web service

Posts under the topic: Create/insert data via detailsview to gridview in a web service

Posted: 6/10/2011

Lurker 20  points  Lurker
  • Joined on: 6/9/2011
  • Posts: 4
it gave me this error: Specified argument was out of the range of valid values.
Parameter name: index

hihi i am doing a web service and provide to Web site B to consume in the grid view

so basically i bind it with the web service...

i am able to retrieve, update and delete data i consume through web service

however i am not able to add a record through the details view

what i want is from the detail view click on new and key in the record and it will update the grid view

this is my code for insert but it give me error

 

  protected void DV_NewRoll_ItemInserting(object sender, DetailsViewInsertEventArgs e)
    {
//Roll_ID, CallerID and Status are integer
        Label Roll_ID = (Label)DV_NewRoll.Rows[1].Cells[1].FindControl("Label1"); 
        TextBoxRoll_Data = (TextBox)DV_NewRoll.Rows[2].Cells[2].FindControl("TextBox1");
       TextBox DataID = (TextBox)DV_NewRoll.Rows[3].Cells[3].FindControl("TextBox2");
        TextBox CallerID = (TextBox)DV_NewRoll.Rows[4].Cells[4].FindControl("TextBox3");
        TextBox UserID = (TextBox)DV_NewRoll.Rows[5].Cells[5].FindControl("TextBox4");
        TextBox Password = (TextBox)DV_NewRoll.Rows[6].Cells[6].FindControl("TextBox5");
        TextBox Return_Status = (TextBox)DV_NewRoll.Rows[7].Cells[7].FindControl("TextBox6");


        WsRollInfo.WSRoll inserts = new WsRollInfo.WSRoll();
        DV_NewRoll.DataSource = inserts.InsertRoll(Convert.ToInt32(Roll_ID.Text),Roll_Data.Text, DataID.Text, Convert.ToInt32(CallerID.Text), UserID.Text, Password.Text, Convert.ToInt32(Status.Text));
       
       //this is where i bind it back to the gridview
      BindNominal();

    }

it give me this error

   Specified argument was out of the range of valid values.
Parameter name: index

 


Posted: 6/11/2011

Guru 16773  points  Guru
  • Joined on: 4/19/2009
  • Posts: 490
  Answered

Hi,

You are trying to access something which doesn't even exists. Try to debug line by line in your mentioned code and try look the values of :

DV_NewRoll.Rows
DV_NewRoll.Rows[1]
DV_NewRoll.Rows[1].Cells[1] 

You will figure out what is the issue.

Thanks,
Raghav 


Page 1 of 1 (2 items)