これは、コードビハインドを介して行う方法です。アイデアを提供するためのダミーのモックアップです。
ASPX コード:
<form id="form1" runat="server">
<asp:ScriptManager ID="ScriptManager1" runat="server">
</asp:ScriptManager>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Label runat="server" ID="Label1" Text=""></asp:Label>
<asp:GridView runat="server" ID="GridView1" OnRowDataBound="GridView1_RowDataBound">
<Columns>
<asp:TemplateField HeaderText="Upload Kundli">
<ItemTemplate>
<asp:FileUpload ID="FileUpload1" runat="server" /><br />
<asp:Button ID="btnupload" runat="server" Text="Upload" OnClick="btnupload_Click" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
<HeaderStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</form>
コード ビハインド (ASPX.CS):
protected void Page_Load(object sender, EventArgs e)
{
if (!IsPostBack)
{
List<int> gridItems = new List<int>();
gridItems.Add(1);
gridItems.Add(2);
GridView1.DataSource = gridItems;
GridView1.DataBind();
}
}
protected void GridView1_RowDataBound(Object sender, GridViewRowEventArgs e)
{
//May not need this if. So check depending on what and how you are binding.
if (e.Row.RowType == DataControlRowType.DataRow)
{
Button UploadButon = (Button) e.Row.Cells[0].FindControl("btnupload");
if(UploadButon != null)
{
if (this.ScriptManager1 != null)
{
this.ScriptManager1.
RegisterAsyncPostBackControl(UploadButon);
}
}
}
}
protected void btnupload_Click(object sender, EventArgs e)
{
Label1.Text = Label1.Text + "a";
}