Gridview with listbox when editing!

  • Thread starter Marcos Beccar Varela | GamaCom Argentina
  • Start date
M

Marcos Beccar Varela | GamaCom Argentina

Hello Everyone. I need to use a gridview, that when I use the Update command
one of the colums, instead of showing a textbox where the user can write, I
need
a combobox (listobx), where there are 3 options.
EG OF GRIDVIEW:
USUER AGE
carlosg old
rominat young
gonzalor normal
florenciat young
roberto old

Thank you!
 
M

Manekurt

Thank you, I´ve made it this way.


<HeaderTemplate>Estado</HeaderTemplate>

<ItemTemplate>

<asp:Label Width="50px" ID="Label5" runat="server" text='<%#
Eval("est_ped_desc")%>'></asp:Label>

</ItemTemplate>

<EditItemTemplate>


<asp:ListBox Rows="1" runat="server" ID="id_estado"
DataSourceID="SqlDataSource5" DataValueField="id_estados"
DataTextField="est_ped_desc"></asp:ListBox>

</EditItemTemplate>

</asp:TemplateField>


Do you know how I can pass the parameter of the value to the sqldatasource?
Thank you
 
G

Guest

As below:

<asp:ListBox Rows="1" runat="server" ID="id_estado"
DataSourceID="SqlDataSource5" DataValueField="id_estados"
 
G

GamaCom Argentina | Marcos Beccar Varela

Thank you, I´m having trouble understandig parameters from gridview to
sqldatasource.
everything goes fine, but not update done. No error, but not update.
Thank again



<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="4"

DataSourceID="SqlDataSource3" ForeColor="#333333" GridLines="None"
Width="544px">


<FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />

<Columns>


<asp:BoundField AccessibleHeaderText="id_solicitinscr"
DataField="id_solicitinscr"

ReadOnly="True" ShowHeader="False" Visible="False" />


<asp:BoundField AccessibleHeaderText="Jugador" DataField="id_jugador"
HeaderText="Jugador"

ReadOnly="True">

<ItemStyle Font-Bold="True" />

</asp:BoundField>


<asp:BoundField AccessibleHeaderText="Fecha" DataField="soli_fecha"
DataFormatString="{0:d}" HeaderText="Fecha" ReadOnly="True" />


<asp:TemplateField>


<HeaderTemplate>Estado</HeaderTemplate>

<ItemTemplate>

<asp:Label Width="50px" ID="Label5" runat="server" text='<%#
Eval("est_ped_desc")%>'></asp:Label>

</ItemTemplate>

<EditItemTemplate>



<asp:ListBox Rows="1" runat="server" ID="id_estado"
DataSourceID="SqlDataSource5" DataValueField="id_estados"
DataTextField="est_ped_desc"></asp:ListBox>

</EditItemTemplate>

</asp:TemplateField>

<asp:CommandField CancelText="Cancelars" EditText="Editar"
InsertVisible="False" ShowEditButton="True" SelectText="Seleccionar"
UpdateText="Grabar">

<ItemStyle Width="50px" />

</asp:CommandField>

</Columns>

<RowStyle BackColor="#F7F6F3" ForeColor="#333333" />

<EmptyDataTemplate>

<asp:Label ID="Label2" runat="server" Font-Bold="True" Text="Sin
Solicitudes"></asp:Label>

</EmptyDataTemplate>

<EditRowStyle BackColor="#999999" CssClass="mk_cellitem" />

<SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333"
/>

<PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center"
/>

<HeaderStyle BackColor="#43597F" BorderStyle="None" BorderWidth="0px"
Font-Bold="True"

ForeColor="White" HorizontalAlign="Left" Wrap="True" />

<AlternatingRowStyle BackColor="White" ForeColor="Black" />

</asp:GridView>




<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$
ConnectionStrings:ClubSiteDB %>"

ProviderName="<%$ ConnectionStrings:ClubSiteDB.ProviderName %>"
SelectCommand="SELECT mkg_juginscriptsoli.id_solicitinscr,
mkg_juginscriptsoli.id_jugador, mkg_juginscriptsoli.soli_fecha,
mkg_estados_solicit.est_ped_desc FROM mkg_juginscriptsoli INNER JOIN
mkg_estados_solicit ON mkg_juginscriptsoli.soli_estado =
mkg_estados_solicit.id_estados INNER JOIN aspnet_Users ON
mkg_juginscriptsoli.id_jugador = aspnet_Users.UserName WHERE
(mkg_juginscriptsoli.id_torneo = @id) ORDER BY
mkg_juginscriptsoli.soli_fecha"

UpdateCommand="UPDATE mkg_juginscriptsoli SET soli_estado = @id_estados
WHERE id_solicitinscr = @id_solicitinscr">

<SelectParameters>

<asp:parameter DefaultValue="1" Name="id" />

</SelectParameters>

<UpdateParameters>

<asp:parameter Name="id_estados" />

<asp:parameter Name="id_solicitinscr" />

</UpdateParameters>

</asp:SqlDataSource>

<asp:SqlDataSource ID="SqlDataSource5" runat="server" ConnectionString="<%$
ConnectionStrings:ClubSiteDB %>"

ProviderName="<%$ ConnectionStrings:ClubSiteDB.ProviderName %>"
SelectCommand="SELECT id_estados, est_ped_desc
FROM
mkg_estados_solicit">

</asp:SqlDataSource>
 

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,756
Messages
2,569,535
Members
45,008
Latest member
obedient dusk

Latest Threads

Top