G
Guest
Hi folks,
I really need help with the following scenario,
I'm going to describe as well as a I can what the setup is and what I can't
understand
I'm using the framework 1.1 using ASP.net with C#
I have a datagrid that is bound to a datasource (through ADO.net) and all
that works
I haven't autogenerated the columns and I haven't used the <asp:boundcolumn
instead I have three columns preceded by two buttons and this kind of markup
<!-- Datagrid declaration -->
<asp:datagrid id="dgRDs" runat="server"
AutoGenerateColumns="False" CssClass="DataGridClass">
<AlternatingItemStyleCssClass="TableCellAlternating"/>
<ItemStyle CssClass="TableCellNormal"/>
<HeaderStyle CssClass="TableHeader" />
<SelectedItemStyle BackColor=#999999 />
<!-- columns start here -->
<Columns>
<asp:ButtonColumn runat="server" Text="Select" CommandName="Select"/>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
HeaderText="Edit Data" CancelText="Cancel"
EditText="Edit"></asp:EditCommandColumn>
<asp:TemplateColumn HeaderText="RD File Number">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "rd_file_no") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtRdfileno" Runat="server" Text='
<%# DataBinder.Eval(Container.DataItem,"rd_file_no") %>' />
</EditItemTemplate>
</asp:TemplateColumn>
<!-- 2 more columns with exactly the same markup but pointing to differnt
fields -->
</columns>
</datagrid>
As you can see I have two Template columns per column
1 to give the unedited look and one to add a textbox (with an id) for the
edited row look
here's what I'm mystified about
I have a 'Select' Button column and Dino Esposito in his magnum opus says:
There is no need to write an ItemCommand handler, the described behavior is
built-in
i.e when you click the Select hyperlink whatever style you chose becomes the
background of the row
and indeed he's right and it does do that...
but...
it also puts the row into Edit mode even though I'm not choosing the Edit
hyperlink (which does have an event handler)
This is my question.
how can I select a row without also placing it in Edit mode
I went with the <asp:TemplateColumn> route because I wanted to be able to
used named text boxes, when I do an update, and not just have the Datagrid
control give a whole load of meaningless autogenerated names
if you can help me with my select Question, I'd greatly appreciate it
Regards and thanks in advance,
CharlesA
I really need help with the following scenario,
I'm going to describe as well as a I can what the setup is and what I can't
understand
I'm using the framework 1.1 using ASP.net with C#
I have a datagrid that is bound to a datasource (through ADO.net) and all
that works
I haven't autogenerated the columns and I haven't used the <asp:boundcolumn
markup either
instead I have three columns preceded by two buttons and this kind of markup
<!-- Datagrid declaration -->
<asp:datagrid id="dgRDs" runat="server"
AutoGenerateColumns="False" CssClass="DataGridClass">
<AlternatingItemStyleCssClass="TableCellAlternating"/>
<ItemStyle CssClass="TableCellNormal"/>
<HeaderStyle CssClass="TableHeader" />
<SelectedItemStyle BackColor=#999999 />
<!-- columns start here -->
<Columns>
<asp:ButtonColumn runat="server" Text="Select" CommandName="Select"/>
<asp:EditCommandColumn ButtonType="LinkButton" UpdateText="Update"
HeaderText="Edit Data" CancelText="Cancel"
EditText="Edit"></asp:EditCommandColumn>
<asp:TemplateColumn HeaderText="RD File Number">
<ItemTemplate>
<%# DataBinder.Eval(Container.DataItem, "rd_file_no") %>
</ItemTemplate>
<EditItemTemplate>
<asp:TextBox ID="txtRdfileno" Runat="server" Text='
<%# DataBinder.Eval(Container.DataItem,"rd_file_no") %>' />
</EditItemTemplate>
</asp:TemplateColumn>
<!-- 2 more columns with exactly the same markup but pointing to differnt
fields -->
</columns>
</datagrid>
As you can see I have two Template columns per column
1 to give the unedited look and one to add a textbox (with an id) for the
edited row look
here's what I'm mystified about
I have a 'Select' Button column and Dino Esposito in his magnum opus says:
There is no need to write an ItemCommand handler, the described behavior is
built-in
i.e when you click the Select hyperlink whatever style you chose becomes the
background of the row
and indeed he's right and it does do that...
but...
it also puts the row into Edit mode even though I'm not choosing the Edit
hyperlink (which does have an event handler)
This is my question.
how can I select a row without also placing it in Edit mode
I went with the <asp:TemplateColumn> route because I wanted to be able to
used named text boxes, when I do an update, and not just have the Datagrid
control give a whole load of meaningless autogenerated names
if you can help me with my select Question, I'd greatly appreciate it
Regards and thanks in advance,
CharlesA