William Youngman schrieb:
Code called in the ItemDataBound method of the gridview
/if (e.Item is GridViewItem)/
/{/
/GridViewItemDataItem = e.Item as GridViewItem;/
/Label label = (Label)DataItem.FindControl("lblPID");/
/if (label != null)/
/{/
/label.ID = "PID" + label.Text;/
/AJ_DropDown.TargetControlID = label.ID; --/ Proposal number for current row
/}/
/}/
Hi Bill,
I'm fairly new to ASP.NET and I might be completely wrong on this, but
why would you set the ID of the label? Shouldn't it be retrieving the
complete ID (which is I think something made up from the gridview ID,
the row ID and the label ID itself and should be stored in the property
ClientID) and assigning that to TargetControlID?
As another approach, try to convert the column with the record label to
a TemplateColumn (if it isn't yet), then you should be able to
declaratively bind the label ID. Here's a snippet of what worked for me:
<asp:TemplateField>
<ItemTemplate>
<ajaxControls:ConfirmButtonExtender ID="cbe" runat="server"
TargetControlID="lbtnDelete" ConfirmText="Really delete?" />
<asp:LinkButton ID="lbtnDelete" runat="server"
CausesValidation="False" CommandName="Delete" Text="Löschen">
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
(This is assuming that you want the drop down list to be displayed in
the gridview, maybe in an EditItemTemplate instead of the ItemTemplate
above.)
Hope this helps,
Cheers,
Roland