The AspxButton in the Gridview doesnt fire…
Code:
<dx:ASPxGridView ID="grdFields" runat="server" AutoGenerateColumns="False" KeyFieldName="FieldId" DataSourceID="odsFields"
SettingsBehavior-ConfirmDelete="true" EnableViewState="false"
SettingsText-ConfirmDelete="Möchten Sie das Feld wirklich löschen?"
OnHtmlRowCreated="grdFields_HtmlRowCreated" EnableCallBacks="true">
…
<dx:GridViewDataTextColumn VisibleIndex="4">
<DataItemTemplate>
<dx:ASPxButton ID="btnRowUp" Border-BorderStyle="Solid" Border-BorderWidth="1px" Wrap="false" Text="Up" OnClick="btnRowUp_Click" AutoPostBack="true" runat="server" CommandArgument ='<%# Eval("FieldId") %>'></dx:ASPxButton>
<dx:ASPxButton ID="btnRowDown" Border-BorderStyle="Solid" Border-BorderWidth="1px" Wrap="false" Text="Down" OnClick="btnRowDown_Click" AutoPostBack="true" runat="server" CommandArgument ='<%# Eval("FieldId") %>'></dx:ASPxButton>
</DataItemTemplate></dx:GridViewDataTextColumn>
Whats the problem?
Hi Elif,
Thank you for this project. We will examine it to determine the cause of this issue. As the first quick note: server-side events are not fired if the control that should handle it has not been correctly instantiated when a postback occurs (see ASP.NET Page Life Cycle Overview). In the context of your scenario this means that the corresponding button should be instantiated when a postback occurs. I recommend that you first check that its parent ASPxGridView is correctly bound to data on every postback. Please review the following Knowledge Base article, which should be helpful:
Why might paging (sorting, grouping, filtering) not work in the ASPxGridView?
Regards,
Serge
Hello Elif,
I see that you use the ASPxButton with the defined ASPxButton.CommandArgument property.
This means that the button will send command parameters to the server. You can handle different commands in the ASPxGridView.RowCommand event handler.
In the attached sample, I illustrate how this event works.
Thanks,
Vest
Thank you Vest, for your response!
Ridiculous but your solution with the rowcommand event worked for a while…
now (after some refactoring etc.) it doesnt! please check my current solution, if i did something wrong!
it's weird for me why the event isnt fired!
thank you,
elif
Again the click event…
<dx:TabPage Text="Themenseite">
<ContentCollection>
<dx:ContentControl runat="server">
<dx:ASPxButton ID="btnThemenSeiteAnlegen" UseSubmitBehavior="true" AutoPostBack="true" Width="100%" Height="30" runat="server" Text="Themenseite für das Formular anlegen…" OnClick="btnThemenSeiteAnlegen_Click" ></dx:ASPxButton>
<dx:ASPxPanel ID="pnlThemaAnlegen" runat="server" Visible="false" EnableViewState="false">
<PanelCollection>
<dx:PanelContent>
<div style="width:150px; float:left;">Text:</div><div style="float:left;">
<dx:ASPxMemo ID="memoThemeText" runat="server" Height="71px" Width="500">
</dx:ASPxMemo>
</div>
<div style="clear:both;"></div>
<div style="width:150px; float:left;">Hintergrund-Thema:</div><div style="float:left;">
<dx:ASPxComboBox ID="comboThemen" runat="server">
</dx:ASPxComboBox>
</div>
<div style="clear:both;"></div>
<hr />
<div>Für die Werbeplatzierung, bitte setzen Sie sich schriftlich mit Martin Altersberger in Verbindung!</div>
<div style="float:right;">
<dx:ASPxButton ID="btnThemenSeiteLoeschen" Width="100%" Height="30" runat="server" Text="Themenseite löschen" OnClick="btnThemenSeiteLoeschen_Click" ></dx:ASPxButton>
</div>
</dx:PanelContent>
</PanelCollection>
</dx:ASPxPanel>
</dx:ContentControl>
</ContentCollection>
</dx:TabPage>
there is no grid and still no button event is fired…
Hello Elif,
It is possible that some code in your application does not allow a form to be posted back to the server. Can you confirm that the ID attribute is defined for the form?
In addition, in order to help me, please provide me with a modified version of my sample (or a simplified version of your project), so that I can reproduce the issue on my side. I am asking this because the parts of your code work fine on my machine :(
Thanks,
Vest