By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
457,728 Members | 1,162 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 457,728 IT Pros & Developers. It's quick & easy.

Gridview with listbox when editing!

P: n/a
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!
Apr 25 '06 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Use a templatefield, you can put what you like in it

"Marcos Beccar Varela | GamaCom Argentina" wrote:
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!

Apr 25 '06 #2

P: n/a
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

"clickon" <cl*****@discussions.microsoft.com> escribió en el mensaje
news:51**********************************@microsof t.com...
Use a templatefield, you can put what you like in it

"Marcos Beccar Varela | GamaCom Argentina" wrote:
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!

Apr 25 '06 #3

P: n/a
As below:

<asp:ListBox Rows="1" runat="server" ID="id_estado"
DataSourceID="SqlDataSource5" DataValueField="id_estados"
DataTextField="est_ped_desc" SelectedValue='<%#Bind("ParameterName")%>'
</asp:ListBox>

"Manekurt" wrote:
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

"clickon" <cl*****@discussions.microsoft.com> escribió en el mensaje
news:51**********************************@microsof t.com...
Use a templatefield, you can put what you like in it

"Marcos Beccar Varela | GamaCom Argentina" wrote:
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!


Apr 25 '06 #4

P: n/a
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>

"clickon" <cl*****@discussions.microsoft.com> escribió en el mensaje
news:46**********************************@microsof t.com...
As below:

<asp:ListBox Rows="1" runat="server" ID="id_estado"
DataSourceID="SqlDataSource5" DataValueField="id_estados"
DataTextField="est_ped_desc" SelectedValue='<%#Bind("ParameterName")%>'
</asp:ListBox>

"Manekurt" wrote:
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

"clickon" <cl*****@discussions.microsoft.com> escribió en el mensaje
news:51**********************************@microsof t.com...
> Use a templatefield, you can put what you like in it
>
> "Marcos Beccar Varela | GamaCom Argentina" wrote:
>
>> 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!
>>
>>
>>


Apr 26 '06 #5

This discussion thread is closed

Replies have been disabled for this discussion.