Solved

Exposing the EditItemIndex property of a DataGrid

Posted on 2004-03-25
5
395 Views
Last Modified: 2010-04-17
Hello,

This is my first time asking a question here so please bear with me.  

I have an editable DataGrid that is populated from an XML document. I have successfully written the code to Create Update and Delete rows to the grid.

The first column is an image.  The xml document contains only the file name of that image, the url is appended at runtime through an AppSettings key.

My dilemma is this ... I need the user to be able to change the picture within the DataGrid as well.  In edit mode it just lists the image file name.  What i have done is I have made the image column read only and turned the actual photo within the grid into an asp:ImageButton.  When the user clicks the image it hides the DataGrid and reveals an asp:panel containing the input file browser for uploading the new photo.  The problem is I havent been able to successfully get the item index of the row from which the picture was selected.  I cant seem to expose the EditItemIndex property of the the Datagrid within the method called by the onClick event in the asp:ImageButton..  I need this so i can write the photo information back to the proper record in the xml document.

 I have done a lot of minor programming in the past but I am new to C# and this is a step farther than I have gone in the past.  I am open to any and all suggestions.


Robert
0
Comment
Question by:robduke
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
5 Comments
 
LVL 10

Expert Comment

by:Kavar
ID: 10678771
<datagridname>.row is the index
0
 

Author Comment

by:robduke
ID: 10679043
I could be wrong but, I do not see a row property for DataGrid.  Intellisense doesnt present it as an option either.

What im looking for is ... Can i get the row index of a Datagrid outside of edit mode.
0
 

Author Comment

by:robduke
ID: 10679959
I figured it out!  :)

Technically i didnt realize that i could use an <asp:imageButton> within the <editTemaplate> of a datagrid.  When I did this it allowed me to call the e.item.itemIndex property of the DataGridCommandEventArgs thus exposing the needed index.

Thanks

Robert
0
 

Accepted Solution

by:
PashaMod earned 0 total points
ID: 10705265
Closed, points refunded.
PashaMod
Community Support Moderator
0

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Although it can be difficult to imagine, someday your child will have a career of his or her own. He or she will likely start a family, buy a home and start having their own children. So, while being a kid is still extremely important, it’s also …
Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question