Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

linkbutton in gridview does not submit form (IsPostBack = fase)

Status
Not open for further replies.

jrenae

Programmer
Jan 18, 2006
142
0
0
US
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.

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>
 
Never mind...I didn't complete my code....the linkbutton is submitting for me.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top