Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > how to: load data in gridview whitout DataSource

Reply
Thread Tools

how to: load data in gridview whitout DataSource

 
 
luukas9
Guest
Posts: n/a
 
      01-21-2008
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.
 
Reply With Quote
 
 
 
 
Eliyahu Goldin
Guest
Posts: n/a
 
      01-21-2008
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


"luukas9" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
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.


 
Reply With Quote
 
 
 
 
luukas9
Guest
Posts: n/a
 
      01-21-2008
Hi,

Thanks for your response. I publish the same thread in:

http://groups.google.es/group/micros...c99f3176a46fed

There are more details here. Sorry.

Thanks.
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: How include a large array? Edward A. Falk C Programming 1 04-04-2013 08:07 PM
GridView's selection isn't causing other GridView's to load data asexpected Rasika WIJAYARATNE ASP .Net 0 12-14-2007 12:25 AM
Gridview sorting event - Gridview Datasource always Null .. why??? jobs ASP .Net Web Controls 2 10-24-2006 07:08 AM
How to get more data from a gridview's underlying datasource? Curious Trigger ASP .Net 4 07-24-2006 06:17 PM
reuse gridview after changing data datasource parameters Greg Ramsey ASP .Net 0 03-19-2006 06:58 PM



Advertisments