how to: load data in gridview whitout DataSource

L

luukas9

Hello,

First, sorry for my English...


I'm triying to load data from store procedure into a gridview.


The most simply is doing 'myGrid.DataSource = myDataTable', but this
'myDataTable' returns a numeric value that I need to transform (this
numeric value is an ID, and i need the description of this ID, that
is
store in another table in my DB)


My Gridview has 3 BoundsFields and one TemplateField for this
'problematic' column, whit a Label:


<Columns>
<asp:BoundField DataField="xxxx" HeaderText="xxxx" />
<asp:TemplateField HeaderText="xxxx">
<ItemTemplate>
<asp:Label ID="xxxx" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
...


I need a idea, because I'm looking for it in google and msdn but no
'good results'... (for example: <asp:Label ... Text=<%Eval("myID")%>
I'm looking for something in the server part)


Thanks.


Now In Spanish:


Hola,


Estoy intentando cargar los datos de un procedimiento almacenado en
un
gridview. Obviamente lo más sencillo es hacer un 'gridview.DataSource
= myDataTable' y que lo haga automáticamente. El problema es que la
consulta ejecutada, me devuelve un campo ID que tendria que
transformar en su descripcion para poder mostrar eso al usuario.


Como se detalla arriba, uso un gridview con BoundsFields para los
campos que no necesito tocar, y un TemplateField para este campo, ya
que no busco asignarlo directamente de la BD.


Necesito alguna idea porque todo lo que he buscado por google y msdn
no indica nada parecido para resolverlo. (por ejemplo: <asp:Label ...
Text=<%Eval("myID")%> estoy buscando algo que se ejecute en la parte
de sevidor no en el aspx sino en el codigo aparte.)



Gracias.
 
E

Eliyahu Goldin

The best thing would be to make a single table that joins your result set
with another table. Can you modify the stored procedure to join with another
table? If no, can you avoid using the stored procedure and to make a view or
a query with the join?


--
Eliyahu Goldin,
Software Developer
Microsoft MVP [ASP.NET]
http://msmvps.com/blogs/egoldin
http://usableasp.net


Hello,

First, sorry for my English...


I'm triying to load data from store procedure into a gridview.


The most simply is doing 'myGrid.DataSource = myDataTable', but this
'myDataTable' returns a numeric value that I need to transform (this
numeric value is an ID, and i need the description of this ID, that
is
store in another table in my DB)


My Gridview has 3 BoundsFields and one TemplateField for this
'problematic' column, whit a Label:


<Columns>
<asp:BoundField DataField="xxxx" HeaderText="xxxx" />
<asp:TemplateField HeaderText="xxxx">
<ItemTemplate>
<asp:Label ID="xxxx" runat="server"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
....


I need a idea, because I'm looking for it in google and msdn but no
'good results'... (for example: <asp:Label ... Text=<%Eval("myID")%>
I'm looking for something in the server part)


Thanks.


Now In Spanish:


Hola,


Estoy intentando cargar los datos de un procedimiento almacenado en
un
gridview. Obviamente lo más sencillo es hacer un 'gridview.DataSource
= myDataTable' y que lo haga automáticamente. El problema es que la
consulta ejecutada, me devuelve un campo ID que tendria que
transformar en su descripcion para poder mostrar eso al usuario.


Como se detalla arriba, uso un gridview con BoundsFields para los
campos que no necesito tocar, y un TemplateField para este campo, ya
que no busco asignarlo directamente de la BD.


Necesito alguna idea porque todo lo que he buscado por google y msdn
no indica nada parecido para resolverlo. (por ejemplo: <asp:Label ...
Text=<%Eval("myID")%> estoy buscando algo que se ejecute en la parte
de sevidor no en el aspx sino en el codigo aparte.)



Gracias.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,903
Latest member
orderPeak8CBDGummies

Latest Threads

Top