Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Value of a cell in a Detail DataGrid

Status
Not open for further replies.

TerryDad2

Programmer
Jul 10, 2002
29
0
0
US
I am working with a detail datagrid trying to the editing functionality that is available with the master datagrid.
I've got it all working except for getting the values that are not entered by the user, i.e. just the value of the cell. I can get the values entered by the user in combo and text boxes, but the databound columns are blank or 'false'.

For the example I'm using, the master table is a list of project groups. The detail is a listing of the project numbers in the project group. In the detail I am trying to add or delete a project number from the group. The on_delete should just have to read the value of the project number and project group number and put that through a delete query. I can't get the values. If I put them in a text box then get the value of the text box it works.

Any thoughts?

Terry
 
Most likely, the values are abstracted into some control.

Are you using boundColumns?

If you are, then I strongly suggest moving everything to <templateColumn>s and for items where you just want text, explicitly declare a label control, give it an id, and a text attribute (it won't be in your intellisense, but it will work), and then you can pull it like any other, so:

<asp:templateColumn>
<itemTemplate>
<asp:label id=lblProjectNum runat=server text='<%# Container.DataItem(&quot;projectNum&quot;) %>' />
</itemTemplate>
</asp:templateColumn>

then, in your on_delete handler:

((Label)e.Item.FindControl(&quot;lblProjectNum&quot;)).Text

will give you your values. You'll find this is a little more time up front declaratively to get your grids set up, but for real workhorse datagrids, it's the only effective way to keep things straight.

good luck
-paul
penny1.gif
penny1.gif

The answer to getting answered -- faq855-2992
 
That worked. I had been spending time converting the entry to a literalcontrol, but that was adding a bunch of spaces that trim function couldn't get rid of.

Thanks.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top