HighTechTalks DotNet Forums  

Datasource in MultiView

ASP.net Web Controls microsoft.public.dotnet.framework.aspnet.webcontrols


Discuss Datasource in MultiView in the ASP.net Web Controls forum.



Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old   
Bryce
 
Posts: n/a

Default Datasource in MultiView - 06-23-2007 , 05:08 PM






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.


Reply With Quote
Reply




Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.