B
Bryce
Not sure how to word this, so if it seems like I'm rambling, sorry..
I have a MultiView object on my form, with a Grid showing a list, with
"Edit", "Select" and "Delete" links. Here's the definition:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="ArticleViewDataSource"
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="ArticleTitle"
HeaderText="ArticleTitle" SortExpression="ArticleTitle" />
</Columns>
</asp:GridView>
Now, as you can see, I have an event handler handling the "OnRowCommand"
event. That method basically changes the view to one that contains a
FormView.
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
articleSelectedValue = int.Parse(
MultiView1.SetActiveView(ArticleEditView);
}
The FormView's datasource has a parameter that I have bound to the GridView
control like so:
<asp:ObjectDataSource ID="ArticleDataSource" runat="server"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetArticleByArticleId"
TypeName="NewsArticleManager">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1"
DefaultValue="0" Name="articleId" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
This doesn't seem to work though. The view changes correctly, but the
articleId being passed is a 0, and thereby displaying nothing.
When I inspect the value of GridView1.SelectedValue on the event handler, it
is null. Not sure if that is the best way to do that.
Any suggestions would be appreciated.
I have a MultiView object on my form, with a Grid showing a list, with
"Edit", "Select" and "Delete" links. Here's the definition:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False"
DataKeyNames="ID" DataSourceID="ArticleViewDataSource"
OnRowCommand="GridView1_RowCommand">
<Columns>
<asp:CommandField ShowDeleteButton="True"
ShowEditButton="True" />
<asp:BoundField DataField="ArticleTitle"
HeaderText="ArticleTitle" SortExpression="ArticleTitle" />
</Columns>
</asp:GridView>
Now, as you can see, I have an event handler handling the "OnRowCommand"
event. That method basically changes the view to one that contains a
FormView.
protected void GridView1_RowCommand(object sender,
GridViewCommandEventArgs e)
{
articleSelectedValue = int.Parse(
MultiView1.SetActiveView(ArticleEditView);
}
The FormView's datasource has a parameter that I have bound to the GridView
control like so:
<asp:ObjectDataSource ID="ArticleDataSource" runat="server"
OldValuesParameterFormatString="original_{0}"
SelectMethod="GetArticleByArticleId"
TypeName="NewsArticleManager">
<SelectParameters>
<asp:ControlParameter ControlID="GridView1"
DefaultValue="0" Name="articleId" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
</asp:ObjectDataSource>
This doesn't seem to work though. The view changes correctly, but the
articleId being passed is a 0, and thereby displaying nothing.
When I inspect the value of GridView1.SelectedValue on the event handler, it
is null. Not sure if that is the best way to do that.
Any suggestions would be appreciated.