Hello,
I have a gridvew with a linkbutton in a template field, but when I click on it, I can't access any of my server side controls in the code behind. The IsPostBack == false. I need to access a lblCampaignId.text that sits outside of the gridview. The CampaignId is a parent id of all the items in the grid, and I don't want to add to the columns in the grid because it's not part of the custom class (type) that I'm using to bind the gridview. I'm using a List<mytype> as the datasource of the gridview.
How can I persist the lblCampaignId?
Thanks for any help.
I have a gridvew with a linkbutton in a template field, but when I click on it, I can't access any of my server side controls in the code behind. The IsPostBack == false. I need to access a lblCampaignId.text that sits outside of the gridview. The CampaignId is a parent id of all the items in the grid, and I don't want to add to the columns in the grid because it's not part of the custom class (type) that I'm using to bind the gridview. I'm using a List<mytype> as the datasource of the gridview.
How can I persist the lblCampaignId?
Thanks for any help.
Code:
<asp:Label ID="lblCampaignId" runat="server"></asp:Label>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField HeaderText="Question Key" >
<ItemTemplate>
<asp:LinkButton ID="lnkQuestion" runat="server" ></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
<asp:HyperLinkField HeaderText="Question Desc" DataTextField="QuestionDesc" NavigateUrl="~/LMPClient/CampaignLeadSpecQuestions.aspx" DataNavigateUrlFields="FieldId" DataNavigateUrlFormatString="~/LMPClient/CampaignLeadSpecQuestions.aspx?QuestionId={0}"/>
</Columns>
</asp:GridView>