Sir
fruit Value is not showing in TextBox after click on partial postback.
<asp:ScriptManager ID="ScriptManager1" runat="server"></asp:ScriptManager>
<asp:UpdatePanel ID="UpdatePanel1" runat="server">
<ContentTemplate>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="false">
<Columns>
<asp:BoundField DataField="FruitName" HeaderText="Fruit Name" />
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkPartial" runat="server" Text="Partial PostBack" OnClick="PartialPostBack" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<ItemTemplate>
<asp:LinkButton ID="lnkFull" runat="server" Text="Full PostBack" OnClick="FullPostBack" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
protected void PartialPostBack(object sender, EventArgs e)
{
string fruitName = ((sender as LinkButton).NamingContainer as GridViewRow).Cells[0].Text;
TextBox1.Text = fruitName;
//string message = "alert('Partial PostBack: You clicked " + fruitName + "');";
//ScriptManager.RegisterClientScriptBlock(sender as Control, this.GetType(), "alert", message, true);
}
protected void FullPostBack(object sender, EventArgs e)
{
string fruitName = ((sender as LinkButton).NamingContainer as GridViewRow).Cells[0].Text;
string message = "alert('Full PostBack: You clicked " + fruitName + "');";
ClientScript.RegisterClientScriptBlock(this.GetType(), "alert", message, true);
}