开发者

display result in gridview

HI all I have a gridview containing columns as written below.

<Columns>
    <asp:BoundField DataField="QUARTERNAME" HeaderText="Quarter" 
       SortExpression="QUARTERNAME" />
    <asp:TemplateField HeaderText="Action" ItemStyle-Width="60%">
        <ItemTemplate>
            <asp:ImageButton ID="SubmitButton" runat="server" 
               ImageUrl="~/btnimages/upload-btn.jpg" CommandName="UploadVATReport"
               OnClick="BtnSubmit_click" 
               CommandArgument='<%# Convert.ToString(Eval("PK_VATPAYMENTID")) %>' />

            <asp:Label ID="lblMsg" runat="server"  Text="Online Status" />     
        </ItemTemplate>
    </asp:TemplateField>
</Columns>

In this, what i want to do is, when i click the imagebutton called submitbutton, i want to show the result in the label 开发者_Python百科of the corresponding row.Pls help.


You'll want to grab the Parent of the ImageButton and the find the lblMsg control.

An example of this in C# is

void BtnSubmit_click(object sender, EventArgs e)
{
  // This gets the image button that fired
  ImageButton SubmitButton = (ImageButton)sender;
  // Get the parent container and find the lblMsg control
  Label lblMsg = (Label)SubmitButton.Parent.FindControl("lblMsg");

  // Set the value of lblMsg to what you want
  lblMsg.Text = "My updated Status";
}

If this isn't what you are looking for, please provide other details.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜