471,122 Members | 1,009 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,122 software developers and data experts.

BoundField cells not visible during rowcommand ??

Can somebody tell me why Jobno and Value BoundFields are not available
during the command SaveParm ? i enter text into the box for Value and
hit the Save button, but all I see is the Parmvalue.

Thanks in advance for any help or information!!

<asp:GridView ID="ParmView" runat="server" SkinID="GridView"
AutoGenerateColumns="False"
DataSourceID="ParmDataSource" AllowSorting="True"
AllowPaging="True" Caption="Paramater Values"
CaptionAlign="Left">
<Columns>
<asp:ButtonField ButtonType="Image" ImageUrl="../
App_Themes/WinXP_Silver/Images/edit.gif" CommandName="EditParm" />
<asp:ButtonField ButtonType="Image" ImageUrl="../
App_Themes/WinXP_Silver/Images/save.gif" CommandName="SaveParm" />
<asp:BoundField DataField="Jobno" Visible="false" />
<asp:BoundField DataField="Parmname" ReadOnly="true"
HeaderText="Parameter" />
<asp:BoundField DataField="Value" ControlStyle-
Width="300px" HeaderText="Value" />
</Columns>
<RowStyle Wrap="False" />
</asp:GridView>
... code behind

Protected Sub RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs ) Handles
rungridview.RowCommand, ParmView.RowCommand
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = sender.Rows(index)

If e.CommandName = "SaveParm" Then
Response.Write(row.Cells(0).Text)
Response.Write(row.Cells(1).Text)
Response.Write(row.Cells(2).Text)
Response.Write(row.Cells(3).Text)
Response.Write(row.Cells(4).Text)
'Jobs.SaveParm(CInt(row.Cells(2).Text), row.Cells(3).Text,
row.Cells(4).Text)
'ParmView.Focus()
'response.Write(row.DataItem("Jobno"))
End If

End Sub

Feb 9 '07 #1
1 5780
Howdy,

Because buttonfield is rendered as
System.Web.UI.WebControls.DataControlLinkButton which is added to cell's
control collection, therefore for cells 0 and 1 you should use:
row.Cells(0).Controls(0).Text
row.Cells(1).Controls(0).Text

--
Milosz
"jobs" wrote:
Can somebody tell me why Jobno and Value BoundFields are not available
during the command SaveParm ? i enter text into the box for Value and
hit the Save button, but all I see is the Parmvalue.

Thanks in advance for any help or information!!

<asp:GridView ID="ParmView" runat="server" SkinID="GridView"
AutoGenerateColumns="False"
DataSourceID="ParmDataSource" AllowSorting="True"
AllowPaging="True" Caption="Paramater Values"
CaptionAlign="Left">
<Columns>
<asp:ButtonField ButtonType="Image" ImageUrl="../
App_Themes/WinXP_Silver/Images/edit.gif" CommandName="EditParm" />
<asp:ButtonField ButtonType="Image" ImageUrl="../
App_Themes/WinXP_Silver/Images/save.gif" CommandName="SaveParm" />
<asp:BoundField DataField="Jobno" Visible="false" />
<asp:BoundField DataField="Parmname" ReadOnly="true"
HeaderText="Parameter" />
<asp:BoundField DataField="Value" ControlStyle-
Width="300px" HeaderText="Value" />
</Columns>
<RowStyle Wrap="False" />
</asp:GridView>
... code behind

Protected Sub RowCommand(ByVal sender As Object, ByVal e As
System.Web.UI.WebControls.GridViewCommandEventArgs ) Handles
rungridview.RowCommand, ParmView.RowCommand
Dim index As Integer = Convert.ToInt32(e.CommandArgument)
Dim row As GridViewRow = sender.Rows(index)

If e.CommandName = "SaveParm" Then
Response.Write(row.Cells(0).Text)
Response.Write(row.Cells(1).Text)
Response.Write(row.Cells(2).Text)
Response.Write(row.Cells(3).Text)
Response.Write(row.Cells(4).Text)
'Jobs.SaveParm(CInt(row.Cells(2).Text), row.Cells(3).Text,
row.Cells(4).Text)
'ParmView.Focus()
'response.Write(row.DataItem("Jobno"))
End If

End Sub

Feb 10 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

6 posts views Thread by Kevin Attard | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.