using button (click event) in panel with PopupControlExtender in gridview template column

 I want to use PopupControlExtender in gridview. when I click "link" linkbutton panel is visible.
I want to insert the data into database  when I  click "Button1" then , however   the sql query is correct but the button1  dosen't insert.
How can I trigger to I am sorry for my english :( thanks...



html xmlns="">


head runat="server">

<title>Untitled Page</title>





<form id="form1" runat="server">

<asp:ScriptManager ID="ScriptManager1" runat="server" />

<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">


<asp:GridView ID="GridView5" runat="server" AutoGenerateColumns="False" BackColor="White"

BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px" CellPadding="3" DataKeyNames="CategoryID"


<FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />


<asp:BoundField DataField="CategoryID" HeaderText="CategoryID" ReadOnly="True" SortExpression="CategoryID" />

<asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />

<asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />

<asp:TemplateField HeaderText="Picture" SortExpression="Picture">



&nbsp;<asp:LinkButton ID="link" runat="server" Text='Sonuc' CommandArgument='<%# DataBinder.Eval(Container, "DataItem.CategoryID") %>'

CommandName="goster" ></asp:LinkButton>&nbsp;



<asp:Panel ID="Panel2" runat="server" BackColor="#FFFFC0" Width="305px" Height="181px" style="display:none" BorderColor="ForestGreen" BorderWidth="2px">

<br />

&nbsp;<asp:Label ID="Label1" runat="server" Text="Customer ID"></asp:Label><asp:Label

ID="Label2" runat="server"></asp:Label><br />

&nbsp;<asp:DropDownList ID="DropDownList1" runat="server">




</asp:DropDownList>&nbsp;<br />

&nbsp;<asp:TextBox ID="TextBox4" runat="server">fhfgh</asp:TextBox>

<br />

&nbsp;<asp:TextBox ID="TextBox5" runat="server"></asp:TextBox>&nbsp;

<br />

&nbsp;<asp:TextBox ID="TextBox6" runat="server"></asp:TextBox>

<asp:Button ID="Button1" runat="server" Text="Kaydet" OnClick="Button1_Click" />

<br />

<br />


<br />

&nbsp; &nbsp;&nbsp;

<cc1:PopupControlExtender ID="PopupControlExtender1" runat="server" TargetControlID="link" PopupControlID="Panel2" Position="bottom">





<RowStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />

<SelectedRowStyle BackColor="#738A9C" Font-Bold="True" ForeColor="#F7F7F7" />

<PagerStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" HorizontalAlign="Right" />

<HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#F7F7F7" />

<AlternatingRowStyle BackColor="#F7F7F7" />

</asp:GridView><asp:SqlDataSource ID="SqlDataSource1" runat="server"

ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>" SelectCommand="SELECT * FROM [Categories]">




&nbsp;&nbsp;<br />

<br />

&nbsp; &nbsp;&nbsp;&nbsp;<br />

<br />

<br />

<br />

<br />

<br />

&nbsp;<br />









Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

If Not Page.IsPostBack Then

GridView5.DataSourceID =



End If

End Sub


Protected Sub GridView5_DataBound(ByVal sender As Object, ByVal e As System.EventArgs) Handles GridView5.DataBound

Dim i As Integer

For i = 0 To GridView5.Rows.Count - 1

Dim lbHEMDurumu As LinkButton = CType(GridView5.Rows(i).FindControl("link"), LinkButton)


'Dim Button1 As Button = CType(GridView5.Rows(i).FindControl("Button1"), Button)




End Sub


Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs)

Dim conn As New SqlConnection("Data Source=server;Initial Catalog=Northwind;Persist Security Info=True;User ID=sa;Password=u1496e")

'Dim PopupControlExtender1 As AjaxControlToolkit.PopupControlExtender

'Dim i As Integer

'For i = 0 To GridView5.Rows.Count - 1

' PopupControlExtender1 = CType(GridView5.Rows(i).FindControl("PopupControlExtender1"), AjaxControlToolkit.PopupControlExtender)


Dim cmd As SqlCommand = New SqlCommand("insert into Categories (CategoryName) values (@CategoryName)", conn)


"@CategoryName", "klklkl")






End Sub


Protected Sub GridView5_RowCommand(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewCommandEventArgs) Handles GridView5.RowCommand

Dim row As GridViewRow = CType(CType(e.CommandSource, Control).NamingContainer, GridViewRow)

Dim rowindex As Integer = CInt(GridView5.DataKeys(row.RowIndex).Value)

Dim lbl As Label = DirectCast(row.FindControl("Label2"), Label)

If e.CommandName = "goster" Then

lbl.Text = e.CommandArgument

End If

End Sub
3/16/2007 2:46:22 PM 17816 articles. 1 followers. Follow

0 Replies

Similar Articles

[PageSpeed] 11


Similar Artilces:

using button(click event) in panel with PopupControlExtender in gridview template column
   I want to use PopupControlExtender in gridview. when I click "link" linkbutton panel is visible.I want to insert the data into database  when I  click "Button1" then , however   the sql query is correct but the button1  dosen't insert. How can I trigger to I am sorry for my english :( thanks...   <html xmlns=""> <head runat="server"> <title>Untitled Page</title> </head> <body> <form id="form1" runat="server"> <asp:ScriptMan...

How to access GridView hidden Column value by clicking a template column button?
Hi: My GridView contains(for simplicity sake) three columns: a hiden template column that contains the DocID (the DataKey), a template column that contains DocTitle and a template button column that contains a button called btnDetails. When the GridView is loaded with data, the user may click the button on a row and obtain the DocID from the hidden column of that row. This seems to be simple enough. However, when the button is clicked, the GridView always returns blank. Any idea why this happens? My code is as follows: ASPX <asp:GridView ID="gvList" runat=&...

How do I invoke the button's click event using using VB.Net
I am programming VB.Net for my project. Can anyone tell me how do I code the "button" server control to invoke the click event? I believe one line of VB code would do. It didn't work when I try btnButton.Click() ???? Thank You! You can always call btnButton_Click(Me, EventArgs.Empty) If I remember correctly. This assumes you have a btnButton_Click(sender as Object, e as EventArgs) sub somewhere in your page. Greg You can also do btnButton_Click.PerformClick() !Jarod Sorry... Forget... The PerformClick method exist only for windows forms b...

gridview checkbox, retrieving other column data in a on click event of button outside gridview.
Hi All.i have a grid view which contains a checkbox in a template field, and number of columns, one of which is not presented to the user. I have a button outside the grid view which is called delete. I have been able to get whether the checkboxes have been checked or not with :CType(row.FindControl("RowLevelCheckBox"), CheckBox).Checked  However, what i would like to do in the click event of the delete button, is find out which checkboxes were selected and use the id (the one that is not presented to the user) and make the relevant changes in the database. Any help ...

Get a Clicked Column Index Integer value for a GridView column using the Sorting Event Handler
I am creating a GridView nested within a UpdatePanel and I got the sorting, paging all down to a sciene using the GridView events handlers. Now, I stumbled to a minor problem that I can't seem to figure out how to go about it. When sorting, I would like the heading color of the clicked sorted column to change (using CSS). I can't seem to dynamically pass the value of the clicked column index to the method. I am using the following reference to change the color of the column but I cannot seem to retreive the value of the clicked index in integer value: GridView1.Columns(trying to...

Update GridView Column Content on click of Button which is included as a column in gridview
 I have Gridview wich has 4 columns1.Name of the Person2.Card Amount3.Template Field of TextBox4. Amount After Transfer I want user to enter the amount in the textbox which gets updated as the total amount (Card Amount + Amount Entered in TextBox) in the 4th column of "Amount After Transfer".I hv tried update Panel and Dynamic Populate bt nothing is working coz the textBox doesnt provide any event function in the code behing page.and javascript function doesnt allow me to refer to any control within the gridview.........PLZ HELP ME...............Thanx   You just place a...

Iwant to select a row and column in gridview with select radiobutton. but No checked change event.below put a button .if click that button to seleced row values will select
I want to select a row and column in gridview using radiobutton in gridview . if which radio button is select that row will select and i want that row column values in outside individual textboxes of next page.  but in that only single radiobutton will select and no post back="true" bcz iam not using checked change property. i inserted button below gridview. if i click the that selected row and columns values are stored into textboxes of next page im using this code .but im getting one column in that row. but i want all columns in that selected row so plz repla...

Image Button inside a template column
Hi all,I have been searching for 2 days on how to handle a imagebutton click event inside a template column on a datagrid control. Does anyone know how to do it?i really need help in this.Any links to sample code or possible can write a short code example for me to follow.Thanx in advance. Hi,   two ways   1. Set CommandName property of the ImageButton to something, then handle DataGrid's ItemCommand event which would be raised when ImageButton with a CommandName is clicked. The given command name comes to the method via event arguments (so you can check that it is that speci...

Manipulating Data Using Template Field to add column in GridView on RowDataBound event
I am a novice at ASP and C#, and come from an RPG programming background so this object oriented stuff is relatively new to me. Here is my situation: I'd like to show a name, birthdate and age in a gridview.  The name and birthdates are in an SQL table and the Age needs to be calculated. I am following an example in shown in a popular book on ASP.NET 3.5 in C#. I am using the RowDataBound event and can sucessfully concatenate the First and Last names into a Template Field.  I can also calculate the age using C# and do things like change the row colors based upon th...

Using update panel to asychorously post back the button click event in listview?
Hi there,I have a listview containing a "Save" button above all ListViewItems. Clicking this button will cause a "global postback", and trigger the rebuilding of whole page. From the user's perspective, the page would be gone, and return back after couple of seconds, which is annoying. I tried to put the listview in an updatepanel, but couldn't set the ControlID of trigger to "Save". Compiler complains that couldn't find the control. Then I set it to the ID of listview, but failed to find the event. My purpose is to make this "Save" call as...

GridView column data blanks in template field after using EDIT then UPDATE buttons...???
I have a gridview which is a detail level in a master/detail relationship.   Anyway the master level record Audits is selected and then all the AuditDetails display in this gridview. Everything works fine, and I use an EVAL statement to replace a few FK IDs with user friendly name fields instead. HOWEVER, once I EDIT/UPDATE a row (after it updates and the webpage reloads) the row I updated is MISSING data in the fields using the EVAL statement. If I click away and come back to the page the data appears again.  It is in the database but on refresh that EVAL field isn't gett...

Command Button inside Gridview Column added at Runtime to fire Click Event
Call for the GridView Masters I have a Gridview whose columns are added Dynamically First and the Second columns being the ButtonThe problem is i am not able to Neither bind OnClick Nor am able to use the Btn.CommandNameBtn.CommandArgument,may be i am missing something.My Grid is loaded successfully with all my Item Template columns but cannot get the onClick Result Gridview Columns added at Runtime with Button in ItemTemplate using a Itemplate classin ItemTemplate Class my code  Public Class GridViewTemplate Implements ITemplate Private _templateType As DataControlRowType Priv...

How to determine the row number when clicking a delete button I added to a template column from a GridView control???
Hello all,I am working using the codebehinde the page with VB.NET 2005 (web application).  I have a gridview where I added a template column, inside that templated column I added a delete button.  I would like to know how could I determine which row number corresponds to the clicked button so I can delete the current record.This is what I have: Protected Sub LinkButtonDelete_Click(ByVal sender As Object, ByVal e As System.EventArgs) Try Dim cmd As SqlCommand Dim objConnection As SqlConnection objConnection = New SqlConnecti...

gridview viewstate off in updatepanel
I have a gridview that i coded up wo AJAX and had working great.  One column had an image button that when clicked toggled the visibility of a panel in that column (pnlEmpDetail.visible = not pnlEmpDetal.visible) and another column with another button that when clicked toggled the visibility of a calendar control.  I then moved the gridview into an AJAX update panel and shutoff the gridview's viewstate in order for AJAX do it's thing on the gridview.  This of course means that the above code doesn't work any longer because the panel and calendar's visible property i...

Web resources about - using button (click event) in panel with PopupControlExtender in gridview template column -

Resources last updated: 11/26/2015 11:37:01 PM