Hi,
I hav got aWDG and a FormView in an updatePanel. There are two sqlDataSources (one catches all and on collect data depending of the ID of the DatabaseRecord).
When I select a Row in WDG the Formview shows the right databaseEntry. When i click edit it alwas shows the first Record. How can i bind the Formview to the selectedRow ( i still get the ID of the row)?
Hello,
You can pass row index in command argument as shown below:
CommandArgument='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).Item, "Row.Index") %>'
Refer to the links below that will give you more details on this:
<http://ko.infragistics.com/community/forums/p/32581/181794.aspx> <http://ko.infragistics.com/community/forums/t/57121.aspx>
I hope this helps.
I tried it without success.
Also this:
CommandArgument='<%# DataBinder.Eval(((Infragistics.Web.UI.TemplateContainer)Container).DataItem, "ID") %>'
somthing like can't convert SystemWeb.UI.WebControls.FormView to Infragistics.Web.UI.TemplateContainer.
I want to mention, that the button is in the FormView.ItemTemplate.
I want to edit my gridRows in a Formview on the same Page.
I can't find any sample for this (Grid = Master, FormView = Detail)
The command argument I have provided works when button is in template column of the WebDataGrid. In order to implement the Master and Child grid scenario, I would suggest you to set EnableAjax property of the WebDataGrid to "False". You need to set AutoPostBackFlags on RowSelectionChanged to "True" and handle RowSelectionChanged event of the WebDataGrid. In this event you can find the selected row's cell text. I have used DataKey Field Text as it is unique value. You can populate corresponding values from the server in the FormView control.
Mark Up of WebDataGrid: <ig:WebDataGrid ID="WebDataGrid1" runat="server" Height="394px" oninitializerow="WebDataGrid1_InitializeRow" Width="616px" EnableAjax="False" DataKeyFields="ID" onrowselectionchanged="WebDataGrid1_RowSelectionChanged"> <Behaviors> <ig:Selection CellClickAction="Row" RowSelectType="Single"> <AutoPostBackFlags RowSelectionChanged="True" /> </ig:Selection> </Behaviors> </ig:WebDataGrid>
RowSelectionChanged Event:
protected void WebDataGrid1_RowSelectionChanged(object sender, SelectedRowEventArgs e) {
string selrowstring= e.CurrentSelectedRows[0].Items.FindItemByKey("ID").Value.ToString();
//Get related data to populate in form view based on selrowstring
}
I am just following up to see if you have any assistance with this matter.
I put the edit-button into the grid and all works fine. Thanks