I'm trying to put an ASPxGridView inside of a PopupControl. Here is my markup:
<dx:ASPxGridView ID="ASPxGridView1" runat="server" Width="100%" AutoGenerateColumns="False"
KeyFieldName="ID">
<columns>
<dx:GridViewDataCheckColumn Caption="Select" FieldName="IsSelected" VisibleIndex="0">
<DataItemTemplate>
<input id="Radio1" type="radio" value='<%# GetFieldValue(Container.DataItem) %>'
<%#GetFieldChecked(Container.DataItem)%> name="myradio" />
</DataItemTemplate>
</dx:GridViewDataCheckColumn>
<dx:GridViewDataHyperLinkColumn VisibleIndex="0" Caption="ID" FieldName="ID">
<PropertiesHyperLinkEdit NavigateUrlFormatString="~/ParticipantSummary.aspx?id={0}">
</PropertiesHyperLinkEdit>
</dx:GridViewDataHyperLinkColumn>
<dx:GridViewDataTextColumn VisibleIndex="1" Caption="Full Name" FieldName="FullName">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn VisibleIndex="2" Caption="Test" FieldName="Test">
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn VisibleIndex="3" Caption="DOB" FieldName="DOB" PropertiesTextEdit-DisplayFormatString="d">
<PropertiesTextEdit DisplayFormatString="d">
</PropertiesTextEdit>
</dx:GridViewDataTextColumn>
<dx:GridViewDataTextColumn VisibleIndex="4" Caption="Address" FieldName="FullAddress">
</dx:GridViewDataTextColumn>
</columns>
<settings gridlines="None" showcolumnheaders="False" />
<settingsbehavior allowfocusedrow="True" />
<clientsideevents focusedrowchanged="function(s, e) {
var row = s.GetRow(s.GetFocusedRowIndex());
if(__aspxIE)
{
row.cells[0].childNodes[0].checked = true;
}
else
row.cells[0].childNodes[1].checked = true;
}" />
</dx:ASPxGridView>
And here is my databinding:
List<Participant> parts = service.GetResults();
List<ParticipantExistsView> views = new List<ParticipantExistsView>();
foreach (Participant p in parts)
{
views.Add(new ParticipantExistsView(p.ID, p.Contact.FirstName, p.Contact.LastName,
p.Test, p.DOB, p.Contact.Address.Address1, p.Contact.Address.Address2,
p.Contact.Address.City, p.Contact.Address.State, p.Contact.Address.PostalCode));
}
ASPxGridView1.DataSource = views;
ASPxGridView1.DataBind();
//ASPxPopupControl1.ShowOnPageLoad = true;
ASPxPopupControl1.Modal = true;
ScriptManager.RegisterStartupScript(Page, this.GetType(), "ShowPopup", "PopupControl.Show();", true);
There are a few problems with this:
- The GridView ClientScript for radio button selection per your tutorial ( http://www.devexpress.com/Support/Center/e/E135.aspx ) throws a script error.
- ASPxPopupControl1.ShowOnPageLoad doesn't work, I have to register the startup script just to show the popup.
- The biggest problem, my GridView won't display data despite being databound. I've also tried other methods of loading data to other user controls I have and the user controls render fine, but with no data. What do I need to do to get my GridView to show properly? (Or any other control that needs data from the server).
Note: I need to programatically show this PopupControl - as well as programatically databind controls in it's content panel.
Hello Jeffrey,
Thanks for questions.
>>1) The GridView ClientScript for radio button selection per your tutorial ( http://www.devexpress.com/Support/Center/e/E135.aspx ) throws a script error.
I'm afraid, I couldn't reproduce your issue (see the attached video). It looks like some other things are involved in this issue, which I have not taken into consideration.
>>2) ASPxPopupControl1.ShowOnPageLoad doesn't work, I have to register the startup script just to show the popup.
I assume that there is some misunderstanding concerning the ASPxPopupControl.ShowOnPageLoad property. The ShowOnPageLoad doesn't provide the display of the ASPxPopupControl on the server. It only means that the popup control will be shown during the first page load in a property set in the markup, or just after adding it to a page, if it is created on the server side. Therefore, the display of the ASPxPopupControl by using a script is correct approach in your scenario.
>>3) The biggest problem, my GridView won't display data despite being databound.
Unfortunately, you didn't write when you bind the grid. Do you bind it via a callback? I'd like to note that by design, while in callback processing, our ASP.NET controls can update only their own render, but not the render of outside controls. In particular, it's impossible to reload the GridView's data.
Based on these points, we need a simple running project (not just a code snippet or a separate file) so that we can reproduce and pinpoint the problem, understand the logic of your application and provide a solution.
Thanks,
Marion
<ClientSideEvents FocusedRowChanged="function(s, e) {
var row = s.GetRow(s.GetFocusedRowIndex());
if(row != null)
{
if(__aspxIE)
{
row.cells[0].childNodes[0].checked = true;
btnSelected.SetEnabled(true);
}
else
row.cells[0].childNodes[1].checked = true;
}
}" />
Thanks for the help guys!
Hello Jeffrey,
You always welcome!
Thanks,
Marion