nature
09-23-2004, 06:02 AM
I need to programmatically change the visible property for a button column in a datawindow. I need to do it programmatically because it should be visible in some rows and not in others.
How do I reference the buttoncolumn from within the ItemCreated event?
<asp:DataGrid id="edgRSVPlist" runat="server" OnSelectedIndexChanged="edgRSVPlist_SelectedIndexChanged" DataKeyField="rsvp_id" OnItemCommand="edgRSVPlist_ItemCommand" AutoGenerateColumns="False" CellSpacing="1" CellPadding="1" PageSize="2" DataSource='<%# GetRSVPlist(request.querystring("EventID")) %>' OnItemCreated="edgRSVPlist_ItemCreated">
<AlternatingItemStyle backcolor="SkyBlue"></AlternatingItemStyle>
<Columns>
<asp:BoundColumn DataField="email_address" HeaderText="Email Address" visible="false"></asp:BoundColumn>
<asp:BoundColumn DataField="Fname" HeaderText="Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Lname" HeaderText="Last"></asp:BoundColumn>
<asp:BoundColumn DataField="rsvp_id" visible="false" ></asp:BoundColumn>
<asp:BoundColumn DataField="sub_id" visible="false"></asp:BoundColumn>
<asp:BoundColumn DataField="e_event_id" visible="false"></asp:BoundColumn>
<asp:ButtonColumn runat="server" Text="<img src=../images/email.gif alt='Email this person' border=0>" HeaderText="Email" CommandName="SendEmail" </asp:ButtonColumn>
<asp:ButtonColumn runat="server" Text="<img src=../images/delete.gif alt='Remove from RSVP List' border=0>" CommandName="remove" HeaderText="Remove"></asp:ButtonColumn>
<asp:TemplateColumn HeaderText="Add">
<ItemTemplate>
<asp:ButtonColumn runat="server" id="btnAdd" visible="false" Text="<img src=../images/add.gif alt='Add to my Sociables Address Book - enables you to send email invitation to people you've met thru the Sociables.' border=0>" HeaderText="Add" CommandName="add"></asp:ButtonColumn></font id="red"></ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>
How do I reference the buttoncolumn from within the ItemCreated event?
<asp:DataGrid id="edgRSVPlist" runat="server" OnSelectedIndexChanged="edgRSVPlist_SelectedIndexChanged" DataKeyField="rsvp_id" OnItemCommand="edgRSVPlist_ItemCommand" AutoGenerateColumns="False" CellSpacing="1" CellPadding="1" PageSize="2" DataSource='<%# GetRSVPlist(request.querystring("EventID")) %>' OnItemCreated="edgRSVPlist_ItemCreated">
<AlternatingItemStyle backcolor="SkyBlue"></AlternatingItemStyle>
<Columns>
<asp:BoundColumn DataField="email_address" HeaderText="Email Address" visible="false"></asp:BoundColumn>
<asp:BoundColumn DataField="Fname" HeaderText="Name"></asp:BoundColumn>
<asp:BoundColumn DataField="Lname" HeaderText="Last"></asp:BoundColumn>
<asp:BoundColumn DataField="rsvp_id" visible="false" ></asp:BoundColumn>
<asp:BoundColumn DataField="sub_id" visible="false"></asp:BoundColumn>
<asp:BoundColumn DataField="e_event_id" visible="false"></asp:BoundColumn>
<asp:ButtonColumn runat="server" Text="<img src=../images/email.gif alt='Email this person' border=0>" HeaderText="Email" CommandName="SendEmail" </asp:ButtonColumn>
<asp:ButtonColumn runat="server" Text="<img src=../images/delete.gif alt='Remove from RSVP List' border=0>" CommandName="remove" HeaderText="Remove"></asp:ButtonColumn>
<asp:TemplateColumn HeaderText="Add">
<ItemTemplate>
<asp:ButtonColumn runat="server" id="btnAdd" visible="false" Text="<img src=../images/add.gif alt='Add to my Sociables Address Book - enables you to send email invitation to people you've met thru the Sociables.' border=0>" HeaderText="Add" CommandName="add"></asp:ButtonColumn></font id="red"></ItemTemplate>
</asp:TemplateColumn>
</Columns>
</asp:DataGrid>