Click here to Skip to main content
15,913,304 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Java Script is not running with Mozilla Firefox Pin
Saurabh126213-May-09 19:59
Saurabh126213-May-09 19:59 
Generalscript injection probelms and solutions Pin
Member 475589313-May-09 1:04
Member 475589313-May-09 1:04 
GeneralRe: script injection probelms and solutions Pin
Abhijit Jana13-May-09 1:33
professionalAbhijit Jana13-May-09 1:33 
GeneralRe: script injection probelms and solutions Pin
Baran M13-May-09 18:22
Baran M13-May-09 18:22 
QuestionPath of the file locally and in the web server? Pin
Subin Alex13-May-09 0:02
Subin Alex13-May-09 0:02 
AnswerRe: Path of the file locally and in the web server? Pin
Baran M13-May-09 0:43
Baran M13-May-09 0:43 
AnswerRe: Path of the file locally and in the web server? Pin
saanj13-May-09 2:26
saanj13-May-09 2:26 
QuestionGetting a Value of a Hidden Field in Gridview Pin
Vimalsoft(Pty) Ltd12-May-09 23:58
professionalVimalsoft(Pty) Ltd12-May-09 23:58 
Good day

On RowDataBound event i have hidden the Field called ID that will appear after the Check Box like this
protected void GridView1_RowDataBound(object sender, GridViewRowEventArgs e)
   {
       e.Row.Cells[1].Visible = false;
   }


Now its time to Delete the Selected Records from a Gridview and i have the Following code on the Delete Button

foreach (GridViewRow row in GridView1.Rows)
          {
              CheckBox chkbx = (CheckBox)row.FindControl("myCheckBox");
              // only add non empty staff names
              if (chkbx != null && chkbx.Checked)
              {
                  List.Add(GridView1.Columns[1]);

                  Userarr.Add(GridView1.Columns[2]);

                  for(int i = 0 ; i < List.Count ; i++)
                  {
                      int Staff_ID  = obj.Get_User_Id(Convert.ToString(Userarr[i]),Convert.ToString(Session["ActiveDatabase"]));

                      obj.Responsibility_Caretaker_Remove(Convert.ToInt32(List[i]), Staff_ID,Convert.ToString(Session["ActiveDatabase"]));
                  }


              }

          }


I know you will complain about Arraylist, lets look at the Solution, i will change later.
Now what am doing here is: I add the Value of the second Field and the third to Different Arraylist and using for loop and calling a method that will call a Sp that will Delete the record based on those two Fields. Now my Problem is that the Field

List.Add(GridView1.Columns[1]);


has been set to false in the Visible Property as you have seen above. And am getting index out of bounds errors. How can i get the value on that hidden Field.


Thanks

Vuyiswa Maseko,

Few companies that installed computers to reduce the employment of clerks have realized their expectations.... They now need more and more expensive clerks even though they call them "Developers" or "Programmers."

C#/VB.NET/ASP.NET/SQL7/2000/2005/2008
http://www.vuyiswamaseko.tiyaneProperties.co.za
vuyiswa@its.co.za
http://www.itsabacus.co.za/itsabacus/

AnswerRe: Getting a Value of a Hidden Field in Gridview Pin
binarymax13-May-09 1:53
binarymax13-May-09 1:53 
GeneralRe: Getting a Value of a Hidden Field in Gridview Pin
Vimalsoft(Pty) Ltd13-May-09 2:01
professionalVimalsoft(Pty) Ltd13-May-09 2:01 
GeneralRe: Getting a Value of a Hidden Field in Gridview Pin
Ibrahim Bello14-May-09 6:25
Ibrahim Bello14-May-09 6:25 
AnswerRe: Getting a Value of a Hidden Field in Gridview Pin
Ibrahim Bello14-May-09 6:22
Ibrahim Bello14-May-09 6:22 
QuestionHTML Table Cell value Pin
Girish48112-May-09 23:40
Girish48112-May-09 23:40 
AnswerRe: HTML Table Cell value Pin
Ramesh Swaminathan12-May-09 23:59
Ramesh Swaminathan12-May-09 23:59 
GeneralRe: HTML Table Cell value Pin
Girish48113-May-09 2:37
Girish48113-May-09 2:37 
GeneralRe: HTML Table Cell value Pin
Baran M13-May-09 18:19
Baran M13-May-09 18:19 
AnswerRe: HTML Table Cell value Pin
saanj13-May-09 2:29
saanj13-May-09 2:29 
QuestionDisplay image in Detailsvew control.... Pin
pranavcool12-May-09 23:18
pranavcool12-May-09 23:18 
AnswerRe: Display image in Detailsvew control.... Pin
Ramesh Swaminathan12-May-09 23:35
Ramesh Swaminathan12-May-09 23:35 
QuestionWeb.config Pin
Xpycm12-May-09 22:24
Xpycm12-May-09 22:24 
AnswerRe: Web.config Pin
Ramesh Swaminathan12-May-09 22:30
Ramesh Swaminathan12-May-09 22:30 
GeneralRe: Web.config Pin
Xpycm13-May-09 0:09
Xpycm13-May-09 0:09 
AnswerRe: Web.config Pin
Baran M12-May-09 22:51
Baran M12-May-09 22:51 
AnswerRe: Web.config Pin
Abhijit Jana12-May-09 22:53
professionalAbhijit Jana12-May-09 22:53 
AnswerRe: Web.config Pin
Xpycm13-May-09 0:37
Xpycm13-May-09 0:37 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.