Problems facing with TEXTBOX embedded with Gridview

Posted by Creatives under ASP.NET AJAX on 8/2/2012 | Points: 10 | Views : 1249 | Status : [Member] | Replies : 3
I'm using textbox inside Gridview with ajax. I've following columns:
SN, ItemCode, ItemName, PurchaseRate, SalesRate

1, where SN is automatic generated in accordance of rows
2, We select ItemName through autocomplete extender.
3, we have to set itemCode columns after selected ItemName
4, we have to set item's purchase Rate on PurchaseRate and item's Sale Rate on SalesRate column after selected itemname on itemname column
3, It's important point no items and codes are displayed initially.
4, when we select itemname on 1st row then itemcode, ItemName, PurchaseRate, SalesRate should be set on same row taking from database on base of itemcode.
5, now finally, after adding some modification on purchase rate or sales rate new row should be added on grid.


Posted by: Gopesh9 on: 8/3/2012 [Member] Starter | Points: 25

You can use LinqDataSource for enabling select,update and delete directly to the database using gridview. Its the task of the LinqDataSource to automatically connect to the database and whatever changes you do to the gridview the database will change according to that.

G. S.
.Net Developer

Creatives, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Creatives on: 8/3/2012 [Member] Starter | Points: 25

can i get complete project source?? but i've no idea can i try ?

Creatives, if this helps please login to Mark As Answer. | Alert Moderator

Posted by: Gopesh9 on: 8/4/2012 [Member] Starter | Points: 25

At first add Linq To Sql Class, by right clicking on the solution Explorer. After adding that you will DataClasses.dbml in that add the table from which you want to link the grid view.

After that add a LinqDataSource to the .aspx file on clicking on that add data souce that will automatically come on that. After that add the grid view and choose the datasource. Now you can select, insert and delete directly to the data source.

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

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">

<html xmlns="">
<head runat="server">
<title>Untitled Page</title>
<form id="form1" runat="server">

<asp:LinqDataSource ID="LinqDataSource1" runat="server"
ContextTypeName="DataClassesDataContext" EnableDelete="True"
EnableInsert="True" EnableUpdate="True" TableName="Bus_Details">
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AllowSorting="True" AutoGenerateColumns="False" DataKeyNames="busno"
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"
ShowSelectButton="True" />
<asp:BoundField DataField="travels" HeaderText="travels"
SortExpression="travels" />
<asp:BoundField DataField="busno" HeaderText="busno" ReadOnly="True"
SortExpression="busno" />
<asp:BoundField DataField="source" HeaderText="source"
SortExpression="source" />
<asp:BoundField DataField="destination" HeaderText="destination"
SortExpression="destination" />
<asp:BoundField DataField="date" HeaderText="date" SortExpression="date" />
<asp:BoundField DataField="time" HeaderText="time" SortExpression="time" />
<asp:BoundField DataField="category" HeaderText="category"
SortExpression="category" />
<asp:BoundField DataField="amount" HeaderText="amount"
SortExpression="amount" />
<asp:BoundField DataField="kilometers" HeaderText="kilometers"
SortExpression="kilometers" />
<asp:BoundField DataField="Mo" HeaderText="Mo" SortExpression="Mo" />
<asp:BoundField DataField="Tu" HeaderText="Tu" SortExpression="Tu" />
<asp:BoundField DataField="We" HeaderText="We" SortExpression="We" />
<asp:BoundField DataField="Th" HeaderText="Th" SortExpression="Th" />
<asp:BoundField DataField="Fr" HeaderText="Fr" SortExpression="Fr" />
<asp:BoundField DataField="Sa" HeaderText="Sa" SortExpression="Sa" />
<asp:BoundField DataField="Su" HeaderText="Su" SortExpression="Su" />

G. S.
.Net Developer

Creatives, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response