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


Top 5 Contributors of the Month
Jean Paul
ASPEvil
SP
satyapriyanayak
Ashutosh Jha
Post New Web Links

find textbox control of gridview using javascript

Posted By:      Posted Date: October 27, 2010    Points: 0   Category :ASP.Net
 

Hi,

 I am inserting a data in gridview row. I have 2 textbox's, 1 label and 1 textbox respectively. Here, I want to do calculations on data which is in first two textboxes and result should be displayed in label and the text in label to be multiplied with 40 and that should be displayed in last textbox.

 This operation to be done in onblur() event of second textbox. To do this I need to find the controls in gridview in onblur() event of the textbox.

  I tried to do this in .cs file but this operation is to be done before inserting in to database on that particular row of gridview.

I searched on the net but i couldn't find the solution. I couldn't know how to find textbox of a gridview using javascript

Please help me.....




View Complete Post


More Related Resource Links

find a Control inside a GridView using jQuery

  

I have databound GridView in my page and I have a hidden DIV in all rows. Each row contains a Button that I want it to make the DIV visible for me! how can I use that with jQuery?!


here is the code page: 


<asp:GridView ID="GridView2" runat="server" AutoGenerateColumns="False" 
                                EnableModelValidation="True" GridLines="None" ShowHeader="False" Width="100%">
                                <Columns>
                                    <asp:T

find the label control of gridview in save button event in C#

  
hi, every one..i want save the gridview in buttonsave event..here i wrote the code like thisfor (int i=0;i<gridview1.row.count;i++){label lbl=(label)gridview1.rows[i].findcontrol("lbl");Textbox txtname=(Textbox)gridview1.rows[i].findcontrol("txtname");}here i got the textbox value but am not getting label value how to get that label value..thanks in advance

WPF : Find a control in GridView

  
I have googled a lot to find the answer to my question but no suitable answer could be found. I am using a gridview of wpf tool kit. which has multiple columns  column structure is like,   <my:DataGridTemplateColumn MaxWidth="15" MinWidth="15" Width="15"> <my:DataGridTemplateColumn.CellTemplate> <DataTemplate> <Button Click="btnContractCollespe_Click" FontSize="9" Height="20" Name="btnContCollespe">+</Button> </DataTemplate> </my:DataGridTemplateColumn.CellTemplate> <my:DataGridTemplateColumn.CellEditingTemplate> <DataTemplate /></my:DataGridTemplateColumn.CellEditingTemplate> </my:DataGridTemplateColumn> <my:DataGridTemplateColumn> when grid renders it displays button "btnContCollespe" in each row. I want some how I could change contents of every button in all rows. Basically this button will expand and collapse gridview 3 fixed columns. so upon expand operation, buttons in all rows should have content "-" and after user performs collapse operation, all button content should change to +. I found no suitable way to find control inside grid. Can anybody help. In asp.net we used to do it by gridview.findcontrol("...") but no such method is available in WPF gridview. please provi

find control in datalist by javascript(Not by Code Behind CS Page or ItemDatabound)

  

Hello all,

I am facing a problem with javascript.Following is the scenario:

I am working on survey application......

I have taken a datalist in which the question in survey are bound in a label control

now user can change color of the question using color picker

color picker have a popup which is closed when user selects a color and

the color of question will be updated as popup closes

So i have to find label control(in which i bound questions)

in datalist by javascript only (not by Cs page or by itemdatabound event because of color picker popup i can not use cs page)

and update the color of label selected by color picker


I googled and found following code but it show null value

var lbl = document.getElementById('<%= Page.Master.FindControl("ContentPlaceHolder1").FindControl("dList").FindControl("lblQuestion") %>');

when I saw the page source following id is generated for label

ctl00_ContentPlaceHolder1_dList_ctl00_lblQuestion
ctl00_ContentPlaceHolder1_dList_ctl01_lblQuestion
and so on


D

Find the RootNode text/value of TreeView control using Javascript

  

Hi,

Is it possible to find the text/value of the Rootnode  of Treeview control using javascript.

Thanks,

Reena


Javascript on GridView Control

  

I would like a total calculation on a GridView column. Here is my code that isn't working. Where am I going wrong? The calculation should be done on GridView2 TextBox13 and the Total should be in TextBox14.


Codebehind Code:

Protected Sub GridView2_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView2.RowDataBound

        If e.Row.RowType = DataControlRowType.DataRow And e.Row.RowState = DataControlRowState.Edit Then
            CType(e.Row.FindControl("TextBox13"), TextBox).Attributes.Add("onkeyup", "calculateSubTotal")
        End If
    End Sub



VB.Net Code:

<%@ Page Title="" Language="VB" MasterPageFile="~/design/NoRightBarMaster.master" AutoEventWireup="false" CodeFile="ApplicantSetup.aspx.vb" Inherits="Secure_ApplicantSetup" %>

<%@ Import Namespace="Artisteer" %>
<%@ Register TagPrefix="artisteer" Namespace="Artisteer" %>
<%@ Register TagPrefix="art" TagName="DefaultMenu" Src="../DefaultMenu.a

ObjectDataSource asp:ControlParameter - textbox is inside Wizard Control - Error "Could not find con

  

I have the following aspx page

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

<!DOCTYPE html

JavaScript Compare BoundField and TextBox in a GridView

  

Hi everyone. 
Below I have a BoundField and a TextBox.
When the user moves away from the TextBox, I need to compare the BoundField (minQty) and the TextBox (Qty).
How do I pass the values of the BoundField and TextBox to a Javascript eg. CheckMinQty(Qty,minQty) when the user moves away from the TextBox?

Round Gridview footer template textbox value based on this JavaScript

  

Hi..

This is my aspx javascript to get total in gridview footer template.. its working fine

The problem is : some time it show footer value is 6.9999999999

I need 6.99 as a result how to achieve this.

Aspx page:-

<script type="text/JavaScript">
<!--
function updateControls(elementId)
{
 var parentElementRef = document.getElementById(elementId);
 var elementRefArray = parentElementRef.getElementsByTagName('INPUT');
 var textBoxTotals = 0;

 for (var i=0; i<elementRefArray.length; i++)
 {
  var elementRef = elementRefArray[i];

  if ( (elementRef.type == 'text') && (elementRef.gridTextBoxType == 'calcTextBox') )
  {
   var textBoxAmount = parseFloat(elementRef.value);
   if ( isNaN(textBoxAmount) == true )
    textBoxAmount = 0;

   textBoxTotals += textBoxAmount;
  }
 }

 if ( isNaN(textBoxTotals) == true ) 
  textBoxTotals = 0;

 for (var i=0; i<elementRefArray.length; i++)
 {
  var elementRef = elementRefArray[i];

  if ( (elementRef.type == 'text') && (elementRef.gridTextBoxType == 'totalsTextBox') )
  {
   elementRef.value = textBoxTotals;
  }
 }
}
// -->
</script>


aspx.cs:-

protected void Gridview1_RowDataBound(object sender, Grid

Find Control inside a View of Multiview using Javascript (document.getElementById)

  

Hi,

i am using the multiview control inside a page and i am trying to find a control using the javascript function document.getElementById. My Problem is that the function returns null cause it cannot find the control. When i open the code of the page from the browser the active view is not rendered so I think thats the reason why I am getting a null value from the function. 

On the HTML code is rendered only the first view or the view that is activated on page load.

Is there any way to find a control inside the view using javascript? or I am doing something wrong?


Thanks a lot.


Set value of TextBox in User Control from Javascript

  

Hi,

I have a page with a user control. I'm trying to populate the values of the textboxes in the User control from javascript in the main page.

 

Screen Interface is as follows:

Sponsor Type: [ ddlbSponsorType   ]

Event: [   TextBoxEvent   ]

Sponsor:  Company Id  : 

                Company Name  :  [  TextBoxCompanyName   ] [Look Up button]

                Contact Person Last Name  :  [  TextBoxPersonLastName  ]

                Contact Person First Name  :  [  TextBoxPersonFirstName   ]

                Contact Person Email  :  [  TextBoxPersonEmail ]

 

Company Id, Company Name, Contact Person fields are all embedded in a user control.  From Javascript, can you let me know how I can populate the company fields.  Using the document.getElementById seems to assign the correct values when I alert the values afte

How to get javascript 'value' property for custom textbox control

  

I created one custom control which contains TextBox as a child control (and contains some other controls? also). After this I placed this control in a Page and I'm trying to get TextBox value(i.e text) through javascript. But I'm unable to get 'value' property directly.

Custom Control code:????

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI.WebControls;

namespace AjaxServerControlDevelopment
{
    public class MyTextBox: CompositeControl
    {
        /// <summary>
        /// TextBox reference variable
        /// </summary>
        public TextBox objTextBox;


        /// <summary>
        /// The TextChanged event
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly")]
        public event EventHandler TextChanged;

        /// <summary>
        /// The ButtonClick event
        /// </summary>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1009:DeclareEventHandlersCorrectly")]
        public event EventHandler<EventArgs> ButtonClick;


            #region Class constructors

        /// <summary>
        /// Default constructor
        

Textbox Editable GridView in ASP.NET

  
This article describes how I made a fully editable gridview in C# using ASP.NET 2. The idea is that the GridView looks and works like an Excel spreadsheet. You see all the cells in the table, and you can edit any of the cells you like, and they are automatically updated (i.e. saved to the database). This is very often how people expect data tables to work in web pages, and I've often seen people clicking in vain on un-editable gridview cells, somehow expecting to edit them, and not understanding that they need to click an Edit button at the end of the row.

Adding Dynamic Rows in ASP.NET GridView Control with TextBoxes and with Delete functionality

  
In my previous examples, I have demonstrated on how to add dynamic rows in GridView control with TextBoxes and how to save the values into the database. Now, seems that most of the developers are asking if how to add a delete functionality with it. So in this example, I'm going to show on how to delete a certain row in the dynamic GridView with TextBoxes.
Categories: 
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