TheWizardofInt Posted May 4, 2004 Posted May 4, 2004 In using the datagrid, I am unable to get a postback from it You can click the rows until your fingers bleed and the postback doesn't fire. I find nothing to enable I am not using AutoGenerate columns. I do dynamically bind the data after a button even has occurred. What I want is for my end user to click a row and to activate the dg.SelectedItemChanged event, which is does not do The sub procedure for this event DOES use the proper event handler. Any idea? Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
LostProgrammer Posted May 4, 2004 Posted May 4, 2004 You have to add an OnItemCommand="SomeEvent" or OnSelectedIndexChanged in the html of the page in the datagrid header tag. -lp Quote
TheWizardofInt Posted May 4, 2004 Author Posted May 4, 2004 I thought so, too - but it doesn't activate a postback at all Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
Moderators Robby Posted May 4, 2004 Moderators Posted May 4, 2004 It should. Can you post your code? Quote Visit...Bassic Software
TheWizardofInt Posted May 4, 2004 Author Posted May 4, 2004 <DIV id="lblEmails" style="DISPLAY: inline; OVERFLOW: auto; WIDTH: 577px; HEIGHT: 230px" runat="server" ms_positioning="FlowLayout"><asp:datagrid id="dgInbox" runat="server" Width="572px" BackColor="White" Font-Name="MS Sans Serif" HorizontalAlign="Center" OnItemCommand="ShowBod" CellPadding="4" AutoGenerateColumns="False" OnEditCommand="ShowMail" Font-Size="2pt" Font-Names="MS Sans Serif"> <SelectedItemStyle BackColor="Yellow"></SelectedItemStyle> <AlternatingItemStyle BackColor="White"></AlternatingItemStyle> <HeaderStyle Font-Bold="True" HorizontalAlign="Center" ForeColor="Black" BackColor="#EEEEEE"></HeaderStyle> <Columns> <mbrsc:RowSelectorColumn SelectionMode="Single" AllowSelectAll="false"></mbrsc:RowSelectorColumn> <asp:BoundColumn DataField="Sender" HeaderText="Sender/Recipient"> <FooterStyle Width="200px"></FooterStyle> </asp:BoundColumn> <asp:BoundColumn DataField="MailRef" HeaderText="Subject"> <FooterStyle Width="230px"></FooterStyle> </asp:BoundColumn> <asp:BoundColumn DataField="Read" HeaderText="Read"> <FooterStyle Width="30px"></FooterStyle> </asp:BoundColumn> <asp:BoundColumn DataField="MailDate" HeaderText="Date"> <FooterStyle Width="100px"></FooterStyle> </asp:BoundColumn> <asp:BoundColumn Visible="False" DataField="RecId" HeaderText="RecID"></asp:BoundColumn> <asp:BoundColumn Visible="False" DataField="Body" HeaderText="RecID"></asp:BoundColumn> <asp:EditCommandColumn ButtonType="LinkButton" UpdateText="" CancelText="" EditText="Open"></asp:EditCommandColumn> </Columns> </asp:datagrid></DIV> I have tried it without the Div as well - doesn't work The mbrsc is a Column Counter which I have also tried removing, but which will not then enable the postback Thanks for your effort on this! Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
takesoln Posted May 7, 2004 Posted May 7, 2004 Hi, Try setting the datagrid's AutoPostback property to true. Then, in the event handler's methods, for (e.g edit click event) check if the "Handles datagrid1.clicked" is present. Quote
TheWizardofInt Posted May 7, 2004 Author Posted May 7, 2004 I am not seeing a postback property on the datagrid object Is this something I need to set up when I actually code out the object? Quote Read the Fovean Chronicles Because you just can't spend your whole day programming!
Moderators Robby Posted May 7, 2004 Moderators Posted May 7, 2004 There is no Autopostback for Datagrids Quote Visit...Bassic Software
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.