Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Open all rows for editing in Datagrid

Status
Not open for further replies.

ISPrincess

Programmer
Feb 22, 2002
318
US
I know there is an easy answer to this, I am still a newbie though.

I have one datagrid - dgSecurity that is called upon clicking the detail button of the main data grid row - dgUsers.

above the dgSecurity grid - I have Edit/save/cancel buttons. In other words - I do not want the grid to automatically come up into edit mode, but do want one entire column/every row to open up into edit mode when the user clicks the Edit button.

Also, the column to be edited is radiobuttonlist.

Am I missing something very basic here? How would I open up the entire column to editing when the user clicks the edit button?

Here is my HTML if anyone needs to see it.
Code:
<tr>
<td align="right" colSpan="2">
<asp:button id="btnFormEdit" runat="server" CausesValidation="False" EnableViewState="False"
Text="Edit" Width="51px" Enabled="False" Visible="false"></asp:button>

<asp:button id="btnFormAccept" runat="server" Text="Accept" Width="51px" Enabled="False" Visible="false"></asp:button>
						
<asp:button id="btnFormCancel" runat="server" CausesValidation="False" Text="Cancel" Width="51px"
Enabled="False" Visible="false"></asp:button>

<asp:button id="btnFormClose" runat="server" CausesValidation="False" Text="Close" Width="51px"
Enabled="False" Visible="false"></asp:button>
</td></tr>
<tr><td vAlign="top">

<asp:datagrid Visible="False" id="dgSecurity" runat="server" EnableViewState="true" Width="25%"
DataKeyField="FormID" AllowSorting="True" AutoGenerateColumns="false" AllowPaging="True" PageSize="10"
OnPageIndexChanged="dgSecurity_Paging">

<SelectedItemStyle BackColor="LightSteelBlue"></SelectedItemStyle>
<HeaderStyle Font-Size="13pt" Font-Bold="True" ForeColor="White" BackColor="Navy"></HeaderStyle>
<PagerStyle Font-Size="8pt" HorizontalAlign="Right" nextpagetext="Next >" PrevPageText="< Previous"
position="TopAndBottom" />
<SelectedItemStyle BackColor="LightSteelBlue"></SelectedItemStyle>
<Columns>
<asp:TemplateColumn HeaderText="Form" ItemStyle-Wrap=False ItemStyle-Font-Size=8pt>
<ItemTemplate>
<%# databinder.eval(container.dataitem, "FormName") %>
</ItemTemplate>
</asp:TemplateColumn>
<asp:TemplateColumn HeaderText="Security level" HeaderStyle-Wrap="True">
<ItemTemplate>
<%# databinder.eval(container.dataitem, "LevelName") %>
</ItemTemplate>
<EditItemTemplate>
<asp:RadioButtonlist ID="radSecurity" Runat=server 
SelectedIndex='<%# databinder.eval(container.dataitem, "SecurityLevelID") %>' 
DataValueField="SecurityLevelID" DataTextField="LevelName" />
</EditItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:datagrid></td></tr>

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
Sorry, I have answered my own question again.

Being new to the datagrid environment, I got myself confused between having edit link buttons for each row and then just opening up a grid column for editing.

All I did, for anyone who has this problem is when the form is loaded, I populate the grid with all the columns including a new one as an <itemTemplate> which I mark Visible=false

Then when the user clicks the form edit button, I hide the display column and make the <itemtemplate> column visible=true.

I apologize again if I took anyones time on this.

Thank you.

PH
I was walking home one night and a guy hammering on a roof called me a paranoid little weirdo.
In morse code.
-Emo Phillips
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top