473,323 Members | 1,547 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,323 software developers and data experts.

VB SCRIPT - Problem in Selecting data in Gridview Control

Hi Guys,

Can You Help Me PLease, I'm Currently facing Problems in my system...
I need some help...
I'm using VB script,ASP.net,MS SQL Server2005

I want to select a specific data in GridviewSummary, the specific data that I selected it will display the its details in GridviewDetails:

I have a 2 gridview the gridviewsummary and gridviewdetails:
gridviewsummary-contains Itemcode field(Primary key)
gridviewdetails-contains have Itemcode field(ForeignKey)

gridviewsummary-contains the summary of Items
gridviewdetails-contains the details of items

when I click one of the item in gridviewsummary, the details of that specific item will display its details in gridviewdetails.

Problem:
Passing the selected datakeyname is ok but the gridviewdetails was not displaying...
what should I do?

Here is the code:
-----------VB Code:-----------------------
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs)

Dim con As New SqlConnection


con.ConnectionString = "Integrated Security=True;data source=ph-erwinm1;" & "persist security info=false;Initial Catalog=ITP"

Const strSQL As String = "SELECT intITPCodePK,strsubmitter,datRequested,datRequired FROM tblITPtransaction"
Dim myCommand As New SqlCommand(strSQL, con)

con.Open()
GVITPSumm.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
GVITPSumm.DataBind()
End Sub


Sub GVITPSumm_SelectedIndexChanged(ByVal sender As Object, ByVal e As EventArgs)
Dim con As New SqlConnection

con.ConnectionString = "Integrated Security=True;data source=ph-erwinm1;" & "persist security info=false;Initial Catalog=ITP"

Dim ITPCode As String
Dim strSQL As String
ITPCode = GVITPSumm.SelectedDataKey.Value.ToString()

strSQL = "SELECT intITPCodeFK, intItemCodePK, strItemType, intQuantity FROM tblItemList WHERE intITPCodeFK = '" & Trim$(ITPCode) & "'"

Dim myCommand As New SqlCommand(strSQL, con)
con.Open()
GVITPDetails.DataSource = myCommand.ExecuteReader(CommandBehavior.CloseConne ction)
GVITPDetails.DataBind()

End Sub




---------HTML Code -------------------

<asp:GridView style="LEFT: 2px; POSITION: relative; TOP: -33px" id="GVITPSumm"
runat="server" Width="606px" Height="18px" OnSelectedIndexChanged="GVITPSumm_SelectedIndexCha nged"
DataKeyNames="intITPCodePK" Font-Bold="False" EnableViewState="False" Font-Names="Arial"
Font-Overline="False" Font-Size="Smaller" AutoGenerateColumns="False" CellPadding="4"
AllowPaging="false" AllowSorting="True" ForeColor="#333333">
<FooterStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True"></FooterStyle>

<Columns>
<asp:CommandField ShowSelectButton="True">
</asp:CommandField>
<asp:BoundField DataField="intITPCodePK" SortExpression="intITPCodePK" HeaderText="ITP Code"></asp:BoundField>
<asp:BoundField DataField="strsubmitter" SortExpression="strsubmitter" HeaderText="Submitter"></asp:BoundField>
<asp:BoundField DataField="datRequested" SortExpression="datRequested" HeaderText="Date Requested"></asp:BoundField>
<asp:BoundField DataField="datRequired" SortExpression="datRequired" HeaderText="Date Required"></asp:BoundField>
</Columns>

<RowStyle BackColor="#EFF3FB"></RowStyle>
<EditRowStyle BackColor="#2461BF"></EditRowStyle>
<SelectedRowStyle BackColor="#D1DDF1" ForeColor="#333333" Font-Bold="True"></SelectedRowStyle>
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center"></PagerStyle>
<HeaderStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True"></HeaderStyle>
<AlternatingRowStyle BackColor="White"></AlternatingRowStyle>
</asp:GridView>




<asp:GridView id="GVITPDetails" runat="server" AutoGenerateColumns="False" DataKeyNames="intITPCodeFK">
<Columns>
<asp:BoundField DataField="intITPCodeFK" SortExpression="intITPCodeFK" HeaderText="ITP Code"></asp:BoundField>
<asp:BoundField DataField="intItemCodePK" SortExpression="intItemCodePK" HeaderText="Item Code"></asp:BoundField>
<asp:BoundField DataField="strItemType" SortExpression="strItemType" HeaderText="Item Type"></asp:BoundField>
<asp:BoundField DataField="intQuantity" SortExpression="intQuantity" HeaderText="Quantity"></asp:BoundField>
</Columns>

<RowStyle BackColor="#EFF3FB"></RowStyle>
<EditRowStyle BackColor="#2461BF"></EditRowStyle>
<SelectedRowStyle BackColor="#D1DDF1" ForeColor="#333333" Font-Bold="True"></SelectedRowStyle>
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center"></PagerStyle>
<HeaderStyle BackColor="#507CD1" ForeColor="White" Font-Bold="True"></HeaderStyle>
<AlternatingRowStyle BackColor="White"></AlternatingRowStyle>
</asp:GridView>



Thank You in Advance
Feb 29 '08 #1
0 1287

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: | last post by:
Hello, Does anyone have an idea on how I can filter the data in the gridview control that was returned by an sql query? I have a gridview that works fine when I populate it with data. Now I...
0
by: misiek | last post by:
Hi all. In asp.net 1.1 I followed instructions from "Top Questions about the DataGrid Web Server Control" article to select some row in DataGrid by clicking anywhere in that row. However in...
5
by: sutphinwb | last post by:
Hi - This could be a simple question. When I relate two tables in a datasetet, how do I get that relation to show up in a GridView? The only way I've done it, is to create a separate table in the...
5
by: Josh Nikle | last post by:
I have a webform containing a GridView control "GridView1" and usercontrol which is also a GridView "GridView2." I have a button column in the usercontrol. The code behind that button adds an...
8
by: Greg Lyles | last post by:
Hi all, I'm trying to develop an ASP.NET 2.0 website and am running into some real problems with what I thought would be a relatively simple thing to do. In a nutshell, I'm stuck on trying to...
1
by: sheenaa | last post by:
Hello Members, I m creating my application forms in ASP.Net 2005 C# using the backend SQL Server 2005. What i have used on forms :: ? On my first form i have used some...
0
by: jaz215 | last post by:
Hi i have an update page where i update data when a user select a row in the gridview, i also have a search function that displays the data in the gridview all those data that matched the search. my...
0
by: jaredciagar | last post by:
Hi Guys, can You help me please in my project.... I'm using VB Script,ASP.Net,MS SQL Server 2005 I want to save data in gridview control from data in textbox control.... How can I Do It?...
1
by: jaredciagar | last post by:
Hi guys...can you help me please.... I'm using ASP.net, MSSQL 2005 and VB Script I have don't know how to bind data in gridview control from database. I want also to allow paging in gridview...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.