.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

hsdsd: how to insert two values from text box1 to gridview g

Posted By:      Posted Date: August 26, 2010    Points: 0   Category :ASP.Net


table a

a                                 b

jhgd                           kljhskjd

sdghdshgd                 jkhdjhdjk

what i need is when enter some values(varchar ) in txt 1 and 2

it should be added in database and shown in gridview1 after i press butt1


any bodyknows full code answer/akdj

View Complete Post

More Related Resource Links

Insert Rows with a GridView

In ASP.NET version 1.x, I used the footer on the DataGrid control to insert new rows by placing a series of TextBox, DropDownLists, CheckBoxes etc. controls on it and then handling a save button. This also works with the GridView in version 2.0 but with one major exception: if your data source is empty, the GridView will hide your footer (and header) and only display the EmptyDataText.

insert the data in database using gridview jquery



I want to use gridview and bind the data and after i want insert the data in database using jquery,

below the link i got for delete


but i want the sample example for insert  row from gridivew and add the database.


update parentpage gridview with the values from child page?


hi   i am having a gridview on each row i am having a update and add button.

on click of either of the button i am opening a popup where the end user will enter data and on clck of ok button in the child page

based on the click ie

if i clicked update i need to update that particular row with the values from child page.

if i clicked on add i need to add a row below the row where i clicked add button .

can anyone help me with this?

Insert data based on gridview user value on row.. how to



I have three column comes from database table(Table1) and one column is for entering data for the user let us consider it look like this 

ItemNo ItemName Qty  uservalue

001       A               50       20

002       A               20       5

003       B               50  

004       C               60      10

005       D               40 

006       E               90      15 


If its 300 row from database to gridview it will show 50 record with page navigation..

What i need is i need to insert data in to database table which gridview row has user value..

The output of the another table(Table2) will look like this after insert

ItemNo ItemName   uservalue

001       A                    20

002       A                      5  

gridview tablecell text emptystring in RowDataBound event when editing


HI and thanks in advance.  asp.net using vb, using a codebehind page.

I have a relatively simple gridview bound to an product table that displays great.  The problem comes when I choose to edit a row.  When I do so, the gridviews' RowDataBound event fires and the values of the text properties of the tablecells in the row evaluate to "" emptystring. 

I do notice that if I break within the GridView1_RowDataBound event during a refresh of the page, the values are there.  But again, when I hit the "Edit" button in the first column (the CommandField column) .  Text properties of the cells resolve to ""

 Here is the code for the event, followed by the gridview in the form (inside an updatepanel)

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound
        If e.Row.RowType = DataControlRowType.DataRow Then  ' not a header, footer row.. etc.
            Dim cellProductNumber As TableCell = e.Row.Cells(3) ' ProductNumber column

'>>>>> after clicking "update", even though a value displays in the gridview,
' the cellProductNumber.Te

Get values of row in a gridview


Hi everyone

I have a problem that can't find a way to do it, I have a gridview with this columns:

ID  |  AreaName  |  CostCenter

with the "Enable Editing" option check and what I want to do is to get the values of areaname and costcenter and assign them to a label control so I can use the values for something else, for example:

ID        AreaName       CostCenter

1          Multiconector   1025

2          One Conector   2065

3          Plug & Play       1445

gridview help on each dynamic row solve this show values based on all columns

<asp:GridView style="Z-INDEX: 101; LEFT: 1px; POSITION: absolute; TOP: 183px" id="Gridview1" runat="server" Width="613px" Height="127px" ForeColor="Teal" Font-Size="12pt" Font-Names="Palatino Linotype" Font-Bold="True" Visible="False" BorderColor="Transparent" AutoGenerateColumns="false" CellSpacing="2" GridLines="None" OnRowCreated="Gridview1_RowCreated" SelectedIndex="5" ShowFooter="true" OnRowDataBound="Gridview1_RowDataBound"><Columns>  <asp:TemplateField HeaderText="ItemCode"><ItemTemplate> <asp:DropDownList id="DropDownList1" tabIndex=16 runat="server" AutoPostBack="True" DataValueField=" ItemCode " DataTextField=" ItemCode" ></asp:DropDownList></ItemTemplate></asp:TemplateField>  <asp:TemplateField HeaderText="ItemName"><ItemTemplate> <asp:DropDownList id="DropDownList2" tabIndex=16 runat="server" AutoPostBack="True" DataValueField="ItemName" DataTextField="ItemName" ></asp:DropDownList> </ItemTemplate> </asp:TemplateField>  <asp:TemplateField HeaderText="Category"&

how do i use javascript to change values of controls inside a gridview

i have 2 labels (lblRate,lblTotal) and a textbox (txtQuantity) in a itemtemplate of a gridview.I want to calculate the products of rate and quantity and show it in Total as the textbox loses focus...i cant use textchanged because i dont want the page to postback.How do i use javascript to achieve this??Please Help Urgently....<asp:TemplateField HeaderText="Rate">                <ItemTemplate>                    <asp:Label ID="lblRate" runat="server" Text='<%# Eval("Rate") %>' />                </ItemTemplate>            </asp:TemplateField> <asp:TemplateField HeaderText="Quantity">                <ItemTemplate>                    <asp:TextBox ID="txtQty" runat="server" />                </ItemTemplate>&

How to insert values into my table the data is coming from inline table valued function

Hi all,   i have table oi want insert values into my table the data is coming from inline table valued function how i can use the inline table valued function to insert datainto my table i have inline function which out puts 3 collumns of data how i can insert this data into my table i have the insert statment like below insert into tablename(c1,c2,c3,c4,c5) select ('abc',....................,'xyz') how i can use the out put put of my inline function to  to insert data into my columns c2,c3,c4. please help me out Thanks & Regards Sunil Yoganna

DropDownList to display values from Two Tables - bold sub heading and normal Text

Hello I hope I am not asking simple one.  SUPPORT SERVICES<     Computing Service    Library or Data Engineering    Civil Engineering    Electrical Engineering  I have the data to display in a DropDownList control shown as above. There is a distinct category Type(example Support Services) and Category Name i.e., Computing Services. I do not want to hard code the values into DropDownList control. I like to get the data from database to display as shown in above Table. Note that Category Type should be displayed in Bold and Category Name in normal Text. Question: In order to achieve the above, 1. How many database Tables and relationships between them  2. Query the data to display in the above format in drop down 3. how should be the code behind i.e, DataTextValue and DataValueField for DropDownList. Please provide with useful code snippets or references. Thanks,

Accessing a row's dropdownlist values AFTER the gridview control is in Edit mode

Hello, I have a gridview control. When it goes into Edit mode, there are 3 dropdownlists in one cell that are populated by separate stored procedures during the RowDataBound event. The 1st dropdownlist's value is used as a parameter to determine what the 2nd dropdownlist is populated with. The 2nd dropdownlist's value is used as a parameter to determine what the 3rd dropdownlist is populated with. Everything works fine when the row is first put into Edit mode. While I'm in Edit mode and I change the selection in the 1st dropdownlist, how do I access the control so I can feed this new parameter to the 2nd dropdownlist? I have the first 2 dropdownlists set for AutoPostBack so that the Page_Load event is fired when the user changes a value. I know how to get access to these controls via the FindControl method when the row is being databound but how do I find the control during the Page_Load event? Thanks for any help!!!   Penny  

Cleanest way of setting max string length for text in GridView cells?

I want to make sure that each row in the table is the height of one line of text only.  I know you can set RowStyle-Wrap="false", but I also don't want any really wide rows.  I know I can go through each cell on RowDataBound or something and cut it to a particular length and then append an ellipsis on the end, but is there a neater way of doing the same thing?

row.Cells[4].Text return nothing in GridView ?

I have a GridView in my page : <asp:GridView ID="GridView1" runat="server" AllowPaging="True" BackColor="White" AutoGenerateColumns="False" EmptyDataText="No data available." BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px" CellPadding="4" Width="729px" ForeColor="Black" GridLines="Vertical" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"> <RowStyle BackColor="#F7F7DE" /> <Columns> <asp:TemplateField HeaderText="TransactionKey" SortExpression="TransactionKey"> <EditItemTemplate> <asp:TextBox ID="TextBoxGridViewTransactionKey" runat="server" Text='<%# Bind("TextBoxTransactionKey") %>'></asp:TextBox> </EditItemTemplate> <ItemTemplate> <asp:Label ID="LabelGridViewTransactionKey" runat="server" Text='<%# Bind("TextBoxTransactionKey") %>'></asp:Label> </ItemTemplate> <HeaderStyle Font-Size="14px" /> <ItemStyle Font-Size="12px" /> </asp:TemplateField> <asp:TemplateField He

Get Text Value in Gridview from Invisible Field

Hello,  I've run into this before, but I was using a formsview and just changed the field to hidden.  If you've seen my previous post I am trying to get the value of a cell out of a gridview to a variable and here is the code: Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs) Handles GridView1.SelectedIndexChanged Dim varClientID As String = GridView1.Rows(GridView1.SelectedIndex).Cells(6).Text.ToString() End Sub This works perfectly if column 6 is visible, but because it's an id number (which is not the primary key) I do not want it visible, but changing it to visible="false" causes this code to return null.  Changing it back to visible and it works.I'm not sure why the visiblity of a control changes the functionality of it.Are there any other ways to get this data out?

Insert columns into GridView and rendercontrol error

Hi I´m inserting columns into a gridview at run time using: gvRageReport.Columns.Insert(index, column) When I render the gridview in orther to export to excel all the excel columns are empty except the new insert columns, but when I add the new columns using gvRageReport.Columns.Add(column) the excell is exported successfully.Any idea?

Gridview RowCommand Event returning null values

HiI'm trying to retreive values entered by users in the textboxes in the footer of the gridview and insert these values into another sql table.My code is as follows :-protected void GridView2_RowCommand(object sender, GridViewCommandEventArgs e)    {       if(e.CommandName.Equals("addnew"))       {                       TextBox t1 = (TextBox)GridView2.FooterRow.FindControl("tfrm");            string frm = t1.Text;            TextBox t2 = (TextBox)GridView2.FooterRow.FindControl("tsub");            string sub = t2.Text;            string cmd = "insert into suggestions values('" + frm + "','" + sub + "','c','c')";            con.Open();            SqlCommand com = new SqlCommand(cmd,con);            int a = com.ExecuteNonQuery();&n

How do I insert values into different colunms but same row in a table using stored procedure

Hi everyone, I wish to create a scenario whereby my Stored Procedure will be able to do an Insert values into two colunms but single row of a table. For instance: AS BEGIN INSERT INTO Table1 (Message1, Number1) VALUES(@Message1, @Number1) END When I do the above stored procedure using SQL Express, and Excecute the stored procedure in VS2005 C# using ADO.Net, the table is updated but the values of Message1 and Number1 are inserted into different rows i.e. when value is inserted into Message1, Number1 is '0' and vice-versa. what I really want is for both Message1 and Number1 to be inserted with values at the same row. How do I acheive this please? Many thanks in advance.
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