Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Keith-Earl #1
How to reference cells once converted to Template Column
Life is easy when I use a simple bound column. I refer to it as:
MyString = e.Item.Cells(2).Text
As soon as I convert this column to a Template Column I loose this ability.
How do a refer to the Text in that cell AFTER I have displayed the grid? I
know I can refer to it with a DataRow going in, but no luck after the grid
has been displayed.
I simply want to grab the contents of a cell the the use selects. I use the
correct event -
datagrid_ItemCommand
but the code blows, say I do not have an object.
Thanks...
Keith-Earl Guest
-
Reference Column Name by string...
If you read half way through my question and think to yourself, "Huh?" you will know exactly how I feel right now. I am dynamically creating a... -
Template column base on another column value
Hello .net expert, I would like to change the color a a column "Name" base on the value of another column "tel" . Is it possible ??? Thanks in... -
Qualify/Reference datagrid cells by name
Now I am referencing datagrid cells by index, eq. '...Cells.Text'. I always find this a little bit tricky to use. With DataSets it is pssible to... -
Bound Column or Template Column (w dAdapater?) in DataGrid
I am able to get the data using DataAdapter and the DataReader. I am more inclined to use DataAdapter because I want to update the data on the SQL... -
Template & layout tables/cells -- Need help
I have a slight problem... After using dreamweaver for a little while, I realized that it would be so much simpler to use a universal template so... -
Keith-Earl #2
Re: How to reference cells once converted to Template Column *UPDATE*
I need to rephrase my question. I actually have no problem *referencing*
the columns, it's just that the data is no longer available and returns an
empty string.
The real issue is that the data is not accessible (as far as I can tell)
once I convert a bound column to a templated problem. I have tried all
kinds of silly things like persisting the DataTable to a Session variable,
etc. I even converted the column BACK to a databound column and it works
like a change.
Quesiton: How do I get to the value contained (right there in front of me
in my browser) in that cell?
Thanks
"Keith-Earl" <css@NO_SPAMConsultWithUs.com> wrote in message
news:eNwCkE9TEHA.2844@TK2MSFTNGP12.phx.gbl...ability.> Life is easy when I use a simple bound column. I refer to it as:
> MyString = e.Item.Cells(2).Text
>
> As soon as I convert this column to a Template Column I loose thisI> How do a refer to the Text in that cell AFTER I have displayed the grid?the> know I can refer to it with a DataRow going in, but no luck after the grid
> has been displayed.
>
> I simply want to grab the contents of a cell the the use selects. I use> correct event -
>
> datagrid_ItemCommand
>
> but the code blows, say I do not have an object.
>
> Thanks...
>
>
Keith-Earl Guest
-
Jos #3
Re: How to reference cells once converted to Template Column *UPDATE*
Keith-Earl wrote:
The idea of a TemplateColumn is that you can add to it the controls> I need to rephrase my question. I actually have no problem
> *referencing* the columns, it's just that the data is no longer
> available and returns an empty string.
>
> The real issue is that the data is not accessible (as far as I can
> tell) once I convert a bound column to a templated problem. I have
> tried all kinds of silly things like persisting the DataTable to a
> Session variable, etc. I even converted the column BACK to a
> databound column and it works like a change.
>
> Quesiton: How do I get to the value contained (right there in front
> of me in my browser) in that cell?
you like. So it depends on which controls you put into the template,
and which information you want to get out of them.
Say, you added a textbox:
<TemplateColumn>
<EditItemTemplate>
<asp:Textbox id="myTextbox" runat="server"></asp:TextBox>
</EditItemTemplate>
</TemplateColumn>
To get the contents of the textbox (for VB.NET):
MyString = CType(e.Item.Cells(2).FindControl("myTextbox"),Tex tbox).Text
You can even do it without bothering about the column index:
MyString = CType(e.Item.FindControl("myTextbox"),Textbox).Tex t
--
Jos
Jos Guest
-
Keith-Earl #4
Re: How to reference cells once converted to Template Column *UPDATE*
Aha, will try. Thank you for your response.
Keith
Keith-Earl Guest
-
Rick Spiewak #5
Re: How to reference cells once converted to Template Column
If you have placed a control in the templated column, just use
..findcontrol("id") on it to find the control, and get at the text.
"Keith-Earl" <css@NO_SPAMConsultWithUs.com> wrote in message
news:eNwCkE9TEHA.2844@TK2MSFTNGP12.phx.gbl...ability.> Life is easy when I use a simple bound column. I refer to it as:
> MyString = e.Item.Cells(2).Text
>
> As soon as I convert this column to a Template Column I loose thisI> How do a refer to the Text in that cell AFTER I have displayed the grid?the> know I can refer to it with a DataRow going in, but no luck after the grid
> has been displayed.
>
> I simply want to grab the contents of a cell the the use selects. I use> correct event -
>
> datagrid_ItemCommand
>
> but the code blows, say I do not have an object.
>
> Thanks...
>
>
Rick Spiewak Guest



Reply With Quote

