.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
Gaurav Pal
Post New Web Links

asp:Button inside a SharePoint Dataview's Rows with onclick event does not call C# function. Pull i

Posted By:      Posted Date: September 15, 2010    Points: 0   Category :SharePoint
asp:Button inside SharePoint Dataview Rows with onclick event does not call C# function. Pull it out of Dataview and works fine. I have a ASP.NET Button I've placed inside a SharePoint  DataView's rows with an onclick event pointing to C# function block inside my page. The page refreshes when I click on them, but it's not hitting that code block. If I move the button to outside the dataview and make the ID fixed, the code works beautifully. what's up with that? the button in the Dataview: td class="ms-vb" style="width: 70px"><asp:Button runat="server" Text="Delete" id="Delete{@ID}" CommandArgument="{@FileRef}" OnClick="DeleteDoc"/> </td> my C# onclick handler (inline C# on the page) void DeleteDoc(object sender, EventArgs e) { Button b = sender as Button; .. more code The buttons are rendered and they look like this: input type="submit" name="ctl00$PlaceHolderMain$g_08acadfd_957b_4112_a426_cc7c81991c1e$Delete1" value="Delete" id="ctl00_PlaceHolderMain_g_08acadfd_957b_4112_a426_cc7c81991c1e_Delete1" Thie code block in inline and I'm working from SharePoint Designer. Not sure how I can troubleshoot this.  Am I missing something here, maybe I need to add an Itemtemplate or something like we need to in the ASP.N

View Complete Post

More Related Resource Links

SharePoint - Passing Dataview Row Arguments to a C# function from a button

RE: SharePoint - Passing Dataview Row infomration to a C# function I've done this with a asp.net Gridview. but does anybody have any examples on how to pass row information from an asp.net button in  SharePoint Dataview rows to an inline C# function? the button Repeats as follows: <asp:Button runat="server" Text="Delete" id="Delete{@ID}"  OnClick="DeleteDoc()"/> My function looks like this: void DeleteDoc(object sender, EventArgs e) { } I tried adding another parameter but get: No overload for 'DeleteDoc' matches delegate 'System.EventHandler' Thank you.

How to call javascript function from Button CLick event



I have a createuserwizard. My CompleteUserWizard in CreateUserWizard is like this..

<asp:CompleteWizardStep ID="MessageStep" runat="server">





  <table style="height: 100%; width: 100%;">


   <td align="center" colspan="2" class="complete_text">






  Your account has been successfully created.




     <td align="center" colspan="2">

    <asp:Button runat="server" ValidationGroup="Createuserwizard1" CommandName="Continue" ID="ContinueButton" CausesValidation="False" Text="Continue" Width="65px" CssClass="Base" />







radio button checked changed event not firing with onclick javascript function



I have used below code.

<asp:RadioButton GroupName="grpAssoc" ID="rbtEvery" runat="server" Text="Everyone"
                                                                                    onclick="return doChangeAssociationType(0);" AutoPostBack="True" oncheckedchanged="rbtEvery_CheckedChanged"

but oncheckedchanged="rbtEvery_CheckedChan

How to get the combobox value inside Datagrid on Edit button click event

Hi     I have Datagrid template column like<DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn>DataGridTemplateColumn Header="Edit" x:Name="Edit" ><DataGridTemplateColumn.CellTemplate></DataGridTemplateColumn.CellEditingTemplate></DataGridTemplateColumn>SelectionChanged="cmbDGTeam_SelectionChanged" IsTabStop="True" /></DataTemplate><ComboBox Height="22" IsEditable="True" IsReadOnly="True" ItemsSource="{Binding}" DisplayMemberPath="Title" SelectedValuePath="TeamID" x:Name="cmbDGTeam"  SelectedValue="{Binding Path=TeamID,Mode=TwoWay}"<DataGridTemplateColumn.CellEditingTemplate><DataTemplate><DataTemplate><TextBlock Text="{Binding Title}"/></DataTemplate></DataGridTemplateColumn.CellTemplate><DataGridTemplateColumn Header="Team" Width="75"><DataGridTemplateColumn.CellTemplate> and Edit button Template column <DataGridTemplateColumn Header="Edit" x:Name="Edit" > </DataGridTemplateColumn.CellTemplate></DataTemplate><Button Content="Edit" IsEnabled="False" x:Name="btnEdit" Click="btnEdit_Click" ></Button>&l

how to call a function or event using jquery Ajex

<asp:Button id="Bu_DocShareSave" runat="server" Text="Save Share" OnClick="Bu_DocShareSave_Click"/>protected void Bu_DocShareSave_Click (object sender, System.EventArgs e){            string S_DocShareID=CCUtility.ToSQL(Utility.GetParam("txt_DownloadFileID"),FieldTypes.Number);            string S_DocStorage=CCUtility.ToSQL(Utility.GetParam("dbo_Storage"),FieldTypes.Text);            string S_DocShareToEmp=Utility.GetParam("dbo_Emp");            string[] SA_DocShareToEmpSplit = S_DocShareToEmp.Split(',');                        int a=0;                         foreach (string Empid in SA_DocShareToEmpSplit){                        if(!Empid.Equals(""))                   {                      

How can i check if button clicked inside a button click event?


private void View_Log_File_Click(object sender, EventArgs e)
                processNotePad = System.Diagnostics.Process.Start("notepad.exe", path_exe + @"\log\logger.txt");


It was easy to check it inside a checkbox event for example:


private void Show_satistics_CheckedChanged(object sender, EventArgs e)


             if (Show_satistics.Checked)
                     statform = new StatisticForm();

Calling Button,s onclick event in javascript code


 Hi Experts.

I have a Button control in webpage.

<asp:Button ID="Button1" runat="server" Text="Button" OnClick="Button1_Click" OnClientClick="test()"/>

When i click on button, i want to check some conditions

How to call a button click event on from an event handler



I got an event handler like this, in this event, i wanted to call another button click event. How can I do that?

protected void gwDetail_SaveCommand(object sender, System.EventArgs e)
            lblMsg.Text = "Saving...";


if (ds.Tables[0].Rows.Count == 0)

how to call button click event of ascx page in the button click event of aspx page



i'm using user control in my page.i need to call the button click event of user control in the button click event of aspx page based on some condition.is it possible?can any one help me?

button inside repeater onclick VB.net


I am trying to call a function when the button is clicked, but the button is inside a repeater. The functions are also called when the page loads because I need to load the values. I am getting this error:

BC30408: Method 'Public Sub getProductSize()' does not have the same signature as delegate 'Delegate Sub EventHandler(sender As Object, e As System.EventArgs)'. 

Button OnClick event not working.


Hi folks,

I am having trouble with two buttons on a page. I dragged them on to the page and then double- clicked each of them in order to create the OnClick events.

I added my code to the events, but when I click the buttons, their respective events aren't being called.

I am very confused!

Any help is appreciated, thanks!

My .aspx code:

<asp:Button ID="Button3" runat="server" Text="Accept" CausesValidation="true" onclick="Button3_Click" />
        <asp:Button ID="Button4" runat="server" Text="Reject" CausesValidation="true" onclick="Button4_Click" />

My Code behind:

protected void Button3_Click(object sender, EventArgs e)
        int id = int.Parse(queryString);

        #region LiveDatabase
        //string connection = ConfigurationManager.ConnectionStrings["LiveDatabase"].ToString();

        #region MySqlDatabase
        string connection = ConfigurationManager.ConnectionStrings["MySqlDatabase"].ToString();

        MySql.Data.MySqlClient.MySqlConnection MyConn = new MySql.Data.MySqlClient.MySqlConnection(connection);

        string query = "UPDATE p

Unable to call javascript function through button's click



i have a javascript function that is placed in a separete file.There are some other functions also.

On a Button's OnClientClick i want to call a javascript function, but it is not called.When i put the same function in my aspx page that function is called. So how can i call that function which is placed in another .js file.

I  have taken some other controls like radio button , that is working fine when i call some functions  that is placed in the same .js file.

I have written like this in Button's OnClintClick property:



asp:button Click event (inside a repeater) lost on postback.


 I have been writing C# code for about 3 years now and have never had this happen.

I am using an asp:repeater (inside an update panel):

<asp:Repeater runat="server" ID="rptRedFolderDocs" OnItemDataBound="rptDataBound">

inside the repeater I have a button with a click event with server side code.

When the page loads, the repeater is databound to a datatable popuplated from SQL connection.  The repeater is NOT bound on postback. I wanted the data to persist.

When the button is click

How "Call a function" from Message box Ok button and how to add "Cancel button" in Message box


Dear Members,

               I have used the following codings to display the message box.

            StringBuilder sb = new StringBuilder();
            sb.Append("<script type = 'text/javascript'>");
            sb.Append(" Do you want save following records...');");
            ClientScript.RegisterStartupScript(this.GetType(), "script", sb.ToString());

              My requirment is to use the "Ok" button in the message box(alert box).

               I have a function Save().

               I mean if i click on the OK button in the message box, then it should call "Save()"  function.

               And also

               I need to add one more button : Cancel in the message box(alert box)

               Please give a hint.            


Problems capturing a Click event from a button inside an asp:table


Hi, I am developing a web site to display some data that is inside a database.

To do this I've created an ASPX web page that opens a connection to a database and retrieves the desired data. After that it populates an asp:table object dynamically.

The problem is that some of the fields that are retrieved from the database are too large to be displayed on the web page, so I decided to make a popup that would be able to display just the desired field.

To do this I've added a button to the asp:table so that when the user clicks it the popup would appear with the contents of the field. However what is happening is that when the user clicks on the button, the page just gets reloaded and the Click event handler is never called.

Below is the code in which I add the button to a TableCell, and the TableCell to the TableRow collection:

// Coluna Mensagem Formatada.
celula = new TableCell();
celula.HorizontalAlign = HorizontalAlign.Center;
Button button = new Button();
button.Text = "...";
button.Click += popupHandler;


Please note that the popupHandler is a delegate to the function below. I am using it as a the Click event handler for testing purposes.

protected void abrirPopup(object sender, Even

I am unable to invoke the CheckPassword() function on button click event.


i have written one javascript function to compare two password fields , to compare password with confirm password field but when I am trying to debug it give me the following error message

  'ASP.default_aspx' does not contain a definition for 'CheckPassword' and no extension method 'CheckPassword' accepting a first argument of type 'ASP.default_aspx' could be found (are you missing a using directive or an assembly reference?)

please see the code

<%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
 <script type="text/javascript" language="javascript">
 function CheckPassword()
 var password;
 var confirmpassword;
 var msg;

All the Button click event perform same validation in sharepoint

I have created a web part in C# which is getting placed in shrepoint.i have two button on it.One is for submitt and other is for clearing the boxes on the web part.i want to clear the text boxes at client side in the click event,how to do that?
i m able to clear it but it is performing at the client side.
Is it required to use concept of JAVA script .If yes then how can i use it
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend