Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
DetailsView1.DataItemIndex = GridView1.SelectedIndex '<-- need help with what goes here
End SubNo clue what is VWD2k5EE, but you'll probably need to access a record ID in
a (hidden or viewable) column stored in the DataView to use for the Grid.
Without knowing your table and how you are building your view, I can't give
you an exact example. What data is in which column and in what format?
"Jon Paal" <Jon nospam Paal @. everywhere dot com> wrote in message
news:%23HQBJzu6FHA.1944@.TK2MSFTNGP14.phx.gbl...
> need help trying to associate master/detail in ASP.net 2.0 with VWD2k5EE
>
> Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal
> e As System.EventArgs)
> DetailsView1.DataItemIndex = GridView1.SelectedIndex '<-- need help
> with what goes here
> End Sub
VWD2k5EE =Visual Web Developer 2005 Express Edition
This worked:
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
DetailsView1.PageIndex = GridView1.SelectedIndex
End Sub
"Joe Schmoe" <Joe.Schmoe@.hamstervision.com> wrote in message news:2%Mef.11443$ih5.6681@.dukeread11...
> No clue what is VWD2k5EE, but you'll probably need to access a record ID in a (hidden or viewable) column stored in the DataView
> to use for the Grid. Without knowing your table and how you are building your view, I can't give you an exact example. What data
> is in which column and in what format?
> "Jon Paal" <Jon nospam Paal @. everywhere dot com> wrote in message news:%23HQBJzu6FHA.1944@.TK2MSFTNGP14.phx.gbl...
>> need help trying to associate master/detail in ASP.net 2.0 with VWD2k5EE
>>
>>
>>
>> Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
>> DetailsView1.DataItemIndex = GridView1.SelectedIndex '<-- need help with what goes here
>> End Sub
>>
OK, isn't that the same thing you had originally. Glad it works. *confused*
"Jon Paal" <Jon nospam Paal @. everywhere dot com> wrote in message
news:uAIwQKv6FHA.2192@.TK2MSFTNGP14.phx.gbl...
> VWD2k5EE =Visual Web Developer 2005 Express Edition
> This worked:
>
> Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal
> e As System.EventArgs)
> DetailsView1.PageIndex = GridView1.SelectedIndex
> End Sub
>
>
> "Joe Schmoe" <Joe.Schmoe@.hamstervision.com> wrote in message
> news:2%Mef.11443$ih5.6681@.dukeread11...
>> No clue what is VWD2k5EE, but you'll probably need to access a record ID
>> in a (hidden or viewable) column stored in the DataView to use for the
>> Grid. Without knowing your table and how you are building your view, I
>> can't give you an exact example. What data is in which column and in what
>> format?
>>
>> "Jon Paal" <Jon nospam Paal @. everywhere dot com> wrote in message
>> news:%23HQBJzu6FHA.1944@.TK2MSFTNGP14.phx.gbl...
>>> need help trying to associate master/detail in ASP.net 2.0 with
>>> VWD2k5EE
>>>
>>>
>>>
>>> Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object,
>>> ByVal e As System.EventArgs)
>>> DetailsView1.DataItemIndex = GridView1.SelectedIndex '<-- need help
>>> with what goes here
>>> End Sub
>>>
>>
>>
no, I changed the code.
found another problem though, the master, when paged , doesn't send correct index to detail
How do I get the code to reflect correct master index with paging enabled ?
[full code to northwind database customers table]
<%@. Page Language="VB" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
Protected Sub GridView1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs)
DetailsView1.PageIndex = GridView1.SelectedIndex
End Sub
</script>
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
</div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataSourceID="SqlDataSource1" OnSelectedIndexChanged="GridView1_SelectedIndexChanged"
Style="z-index: 100; left: 85px; position: absolute; top: 154px" AllowPaging="True" BackColor="LightGoldenrodYellow"
BorderColor="Tan" BorderWidth="1px" CellPadding="2" ForeColor="Black" GridLines="None" Width="231px">
<Columns>
<asp:CommandField ShowSelectButton="True" />
<asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"
ReadOnly="True" SortExpression="ProductID" />
<asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
</Columns>
<PagerSettings FirstPageText="First" LastPageText="Last" Mode="NextPrevious" NextPageText="Next"
PreviousPageText="Prev" />
<FooterStyle BackColor="Tan" />
<SelectedRowStyle BackColor="DarkSlateBlue" ForeColor="GhostWhite" />
<PagerStyle BackColor="PaleGoldenrod" ForeColor="DarkSlateBlue" HorizontalAlign="Center" />
<HeaderStyle BackColor="Tan" Font-Bold="True" />
<AlternatingRowStyle BackColor="PaleGoldenrod" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:NorthwindCSConnectionString %>"
SelectCommand="SELECT * FROM [Alphabetical List of Products]">
</asp:SqlDataSource>
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
DataSourceID="SqlDataSource1" Height="50px" Style="z-index: 102; left: 386px;
position: absolute; top: 160px" Width="270px">
<Fields>
<asp:BoundField DataField="ProductID" HeaderText="ProductID" InsertVisible="False"
ReadOnly="True" SortExpression="ProductID" />
<asp:BoundField DataField="ProductName" HeaderText="ProductName" SortExpression="ProductName" />
<asp:BoundField DataField="SupplierID" HeaderText="SupplierID" SortExpression="SupplierID" />
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID" SortExpression="CategoryID" />
<asp:BoundField DataField="QuantityPerUnit" HeaderText="QuantityPerUnit" SortExpression="QuantityPerUnit" />
<asp:BoundField DataField="UnitPrice" HeaderText="UnitPrice" SortExpression="UnitPrice" />
<asp:BoundField DataField="UnitsInStock" HeaderText="UnitsInStock" SortExpression="UnitsInStock" />
<asp:BoundField DataField="UnitsOnOrder" HeaderText="UnitsOnOrder" SortExpression="UnitsOnOrder" />
<asp:BoundField DataField="ReorderLevel" HeaderText="ReorderLevel" SortExpression="ReorderLevel" />
<asp:BoundField DataField="Discontinued" HeaderText="Discontinued" SortExpression="Discontinued" />
<asp:BoundField DataField="CategoryName" HeaderText="CategoryName" SortExpression="CategoryName" />
</Fields>
</asp:DetailsView>
</form>
</body>
</html
0 comments:
Post a Comment