First gridview's selected row doesn't update second gridview's objectdatasource


I got 2 gridviews on a page, each with its own ObjectDataSource. The first gridview fills itself just normally, no problem there. The second gridview needs to fill itself with other data, where the primary key is the primary key of the selected row of the first gridview.


row: IDfield, x, y, z
row: IDfield, x, y, z (-> this row is selected)
row: IDfield, x, y, z


row:IDfield_of_selected_row_in_gridview1, a, b, c


I tried to do this by configuring the ObjectDataSource behind gridview2 with a parameter pointing to gridview1.selectedValue. (by using the configuration 'wizard')
This doesn't work, probably because the ObjectDataSource only gets filled once, when the page loads, but there is no row selected then so gridview2 remains empty. All the time.
When I select a row from my first gridview, nothing happens to gridview2.

I know that I can do this manually, the databinding (via the codebehind, GridView1_SelectedIndexChanged) and this works, it shows me the data. But then I get the problem that I can't edit it.

So, how do I make it so that whenever I select a row from my first gridview, the second ObjectDataSource refreshes itself and gets the data from my database where the primary key is the primary key of my selected gridview1 row?


I don't know if it helps, but i'll add my sourcecode.






1    <%@ Page Language="C#" MasterPageFile="~/admin/admin.master" AutoEventWireup="true" CodeFile="VoegBestellingToe.aspx.cs" Inherits="admin_VoegDataToe_VoegBestellingToe" Title="Untitled Page" %>
2    <asp:Content ID="Content1" ContentPlaceHolderID="cphMain" Runat="Server">
3        <table style="width: 100%">
4            <tr>
5                <td style="text-align: left; vertical-align: top; width: 500px;">
6                    <h2>Bestellingen</h2>
7                    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
8                        AutoGenerateColumns="False" CellPadding="4" DataKeyNames="BestellingID" DataSourceID="ObjectDataSourceBestellingen"
9                        ForeColor="#333333" GridLines="None" 
10                       onselectedindexchanged="GridView1_SelectedIndexChanged">
11                       <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
12                       <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
13                       <Columns>
14                           <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" 
15                               ValidationGroup="editBestelling" ShowSelectButton="True" />
16                           <asp:BoundField DataField="BestellingID" HeaderText="BestellingID" InsertVisible="False"
17                               ReadOnly="True" SortExpression="BestellingID" />
18                           <asp:TemplateField HeaderText="KlantID" SortExpression="KlantID">
19                               <EditItemTemplate>
20                                   <asp:DropDownList ID="DropDownList2" runat="server" DataSourceID="ObjectDataSourceKlantNaam"
21                                       DataTextField="Naam" DataValueField="KlantID" SelectedValue='<%# Bind("KlantID") %>'>
22                                   </asp:DropDownList>
23                               </EditItemTemplate>
24                               <ItemTemplate>
25                                   <asp:Label ID="Label1" runat="server" Text='<%# Bind("KlantID") %>'></asp:Label>
26                               </ItemTemplate>
27                           </asp:TemplateField>
28                           <asp:TemplateField HeaderText="Besteldatum" SortExpression="Besteldatum">
29                               <EditItemTemplate>
30                                   <asp:TextBox ID="TextBox2" runat="server" 
31                                       Text='<%# Bind("Besteldatum", "{0:d}") %>' ValidationGroup="editBestelling"></asp:TextBox>
32                                   <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" 
33                                       ControlToValidate="TextBox2" CssClass="error" 
34                                       ErrorMessage="Vul een datum in aub." ValidationGroup="editBestelling">*</asp:RequiredFieldValidator>
35                                   <asp:RegularExpressionValidator ID="RegularExpressionValidator1" runat="server" 
36                                       ControlToValidate="TextBox2" CssClass="error" 
37                                       ErrorMessage="Geef een correcte datum in aub." 
38                                       ValidationExpression="\d{1,2}\/\d{2}\/\d{4}" ValidationGroup="editBestelling">*</asp:RegularExpressionValidator>
39                               </EditItemTemplate>
40                               <ItemTemplate>
41                                   <asp:Label ID="Label2" runat="server" Text='<%# Bind("Besteldatum", "{0:d}") %>'></asp:Label>
42                               </ItemTemplate>
43                           </asp:TemplateField>
44                       </Columns>
45                       <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
46                       <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
47                       <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
48                       <EditRowStyle BackColor="#999999" />
49                       <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
50                   </asp:GridView>
51                   <br />
52                   <asp:ValidationSummary ID="ValidationSummary1" runat="server" CssClass="error" 
53                       ValidationGroup="editBestelling" />
54                   <br />
55                   <asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False" CellPadding="4"
56                       DataKeyNames="BestellingID" DataSourceID="ObjectDataSourceBestellingen" DefaultMode="Insert"
57                       ForeColor="#333333" GridLines="None" Height="50px" Width="125px" >
58                       <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
59                       <CommandRowStyle BackColor="#E2DED6" Font-Bold="True" />
60                       <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
61                       <FieldHeaderStyle BackColor="#E9ECF1" Font-Bold="True" />
62                       <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
63                       <Fields>
64                           <asp:BoundField DataField="BestellingID" HeaderText="BestellingID" InsertVisible="False"
65                               ReadOnly="True" SortExpression="BestellingID" />
66                           <asp:TemplateField HeaderText="KlantID" SortExpression="KlantID">
67                               <EditItemTemplate>
68                                   <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("KlantID") %>'></asp:TextBox>
69                               </EditItemTemplate>
70                               <InsertItemTemplate>
71                                   <asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="ObjectDataSourceKlantNaam"
72                                       DataTextField="Naam" DataValueField="KlantID" SelectedValue='<%# Bind("KlantID") %>'>
73                                   </asp:DropDownList>
74                               </InsertItemTemplate>
75                               <ItemTemplate>
76                                   <asp:Label ID="Label1" runat="server" Text='<%# Bind("KlantID") %>'></asp:Label>
77                               </ItemTemplate>
78                           </asp:TemplateField>
79                           <asp:TemplateField HeaderText="Besteldatum" SortExpression="Besteldatum">
80                               <EditItemTemplate>
81                                   <asp:TextBox ID="TextBox2" runat="server" Text='<%# Bind("Besteldatum") %>'></asp:TextBox>
82                               </EditItemTemplate>
83                               <InsertItemTemplate>
84                                    <asp:Calendar ID="Calendar1" runat="server" BackColor="White" BorderColor="White"
85                                       BorderWidth="1px" Font-Names="Verdana" Font-Size="9pt" ForeColor="Black" Height="190px"
86                                       NextPrevFormat="FullMonth" SelectedDate='<%# Bind("Besteldatum") %>' Width="350px">
87                                       <SelectedDayStyle BackColor="#333399" ForeColor="White" />
88                                       <TodayDayStyle BackColor="#CCCCCC" />
89                                       <OtherMonthDayStyle ForeColor="#999999" />
90                                       <NextPrevStyle Font-Bold="True" Font-Size="8pt" ForeColor="#333333" VerticalAlign="Bottom" />
91                                       <DayHeaderStyle Font-Bold="True" Font-Size="8pt" />
92                                       <TitleStyle BackColor="White" BorderColor="Black" BorderWidth="4px" Font-Bold="True"
93                                           Font-Size="12pt" ForeColor="#333399" />
94                                   </asp:Calendar>
95                               </InsertItemTemplate>
96                               <ItemTemplate>
97                                   <asp:Label ID="Label2" runat="server" Text='<%# Bind("Besteldatum") %>'></asp:Label>
98                               </ItemTemplate>
99                           </asp:TemplateField>
100                          <asp:CommandField ShowInsertButton="True" ValidationGroup="AddBestelling" />
101                      </Fields>
102                      <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
103                      <EditRowStyle BackColor="#999999" />
104                      <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
105                  </asp:DetailsView>
106                  <br />
107                  <asp:ValidationSummary ID="ValidationSummary2" runat="server" ValidationGroup="AddBestelling" />
108                  <br />
109                  <asp:ObjectDataSource ID="ObjectDataSourceBestellingen" runat="server" DeleteMethod="Delete"
110                      InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetBestellingen"
111                      TypeName="webshopTableAdapters.BestellingTableAdapter" UpdateMethod="Update">
112                      <DeleteParameters>
113                          <asp:Parameter Name="Original_BestellingID" Type="Int32" />
114                      </DeleteParameters>
115                      <UpdateParameters>
116                          <asp:Parameter Name="KlantID" Type="Int32" />
117                          <asp:Parameter Name="Besteldatum" Type="DateTime" />
118                          <asp:Parameter Name="Original_BestellingID" Type="Int32" />
119                      </UpdateParameters>
120                      <InsertParameters>
121                          <asp:Parameter Name="KlantID" Type="Int32" />
122                          <asp:Parameter Name="Besteldatum" Type="DateTime" />
123                      </InsertParameters>
124                  </asp:ObjectDataSource>
125                  <asp:ObjectDataSource ID="ObjectDataSourceKlantNaam" runat="server" DeleteMethod="Delete"
126                      InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetKlantnaam"
127                      TypeName="webshopTableAdapters.KlantTableAdapter" UpdateMethod="Update">
128                      <DeleteParameters>
129                          <asp:Parameter Name="Original_KlantID" Type="Int32" />
130                          <asp:Parameter Name="Original_Voornaam" Type="String" />
131                          <asp:Parameter Name="Original_Achternaam" Type="String" />
132                          <asp:Parameter Name="Original_Geslacht" Type="String" />
133                          <asp:Parameter Name="Original_Straat" Type="String" />
134                          <asp:Parameter Name="Original_Nr" Type="Int16" />
135                          <asp:Parameter Name="Original_Bus" Type="String" />
136                          <asp:Parameter Name="Original_Postcode" Type="String" />
137                          <asp:Parameter Name="Original_Plaats" Type="String" />
138                          <asp:Parameter Name="Original_Telefoon_privé" Type="String" />
139                          <asp:Parameter Name="Original_Telefoon_mobiel" Type="String" />
140                          <asp:Parameter Name="Original_Telefoon_werk" Type="String" />
141                          <asp:Parameter Name="Original_Email" Type="String" />
142                      </DeleteParameters>
143                      <UpdateParameters>
144                          <asp:Parameter Name="Voornaam" Type="String" />
145                          <asp:Parameter Name="Achternaam" Type="String" />
146                          <asp:Parameter Name="Geslacht" Type="String" />
147                          <asp:Parameter Name="Straat" Type="String" />
148                          <asp:Parameter Name="Nr" Type="Int16" />
149                          <asp:Parameter Name="Bus" Type="String" />
150                          <asp:Parameter Name="Postcode" Type="String" />
151                          <asp:Parameter Name="Plaats" Type="String" />
152                          <asp:Parameter Name="Telefoon_privé" Type="String" />
153                          <asp:Parameter Name="Telefoon_mobiel" Type="String" />
154                          <asp:Parameter Name="Telefoon_werk" Type="String" />
155                          <asp:Parameter Name="Email" Type="String" />
156                          <asp:Parameter Name="Original_KlantID" Type="Int32" />
157                          <asp:Parameter Name="Original_Voornaam" Type="String" />
158                          <asp:Parameter Name="Original_Achternaam" Type="String" />
159                          <asp:Parameter Name="Original_Geslacht" Type="String" />
160                          <asp:Parameter Name="Original_Straat" Type="String" />
161                          <asp:Parameter Name="Original_Nr" Type="Int16" />
162                          <asp:Parameter Name="Original_Bus" Type="String" />
163                          <asp:Parameter Name="Original_Postcode" Type="String" />
164                          <asp:Parameter Name="Original_Plaats" Type="String" />
165                          <asp:Parameter Name="Original_Telefoon_privé" Type="String" />
166                          <asp:Parameter Name="Original_Telefoon_mobiel" Type="String" />
167                          <asp:Parameter Name="Original_Telefoon_werk" Type="String" />
168                          <asp:Parameter Name="Original_Email" Type="String" />
169                      </UpdateParameters>
170                      <InsertParameters>
171                          <asp:Parameter Name="Voornaam" Type="String" />
172                          <asp:Parameter Name="Achternaam" Type="String" />
173                          <asp:Parameter Name="Geslacht" Type="String" />
174                          <asp:Parameter Name="Straat" Type="String" />
175                          <asp:Parameter Name="Nr" Type="Int16" />
176                          <asp:Parameter Name="Bus" Type="String" />
177                          <asp:Parameter Name="Postcode" Type="String" />
178                          <asp:Parameter Name="Plaats" Type="String" />
179                          <asp:Parameter Name="Telefoon_privé" Type="String" />
180                          <asp:Parameter Name="Telefoon_mobiel" Type="String" />
181                          <asp:Parameter Name="Telefoon_werk" Type="String" />
182                          <asp:Parameter Name="Email" Type="String" />
183                      </InsertParameters>
184                  </asp:ObjectDataSource>
185              </td>
186              <td style="text-align: left; vertical-align: top; padding-left: 50px;">
187                  <h2>Bestelinhoud</h2>
188                  <asp:GridView ID="GridView2" runat="server" AllowPaging="True" 
189                      AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" 
190                      DataKeyNames="BestellingID,ArtikelID" 
191                      DataSourceID="ObjectDataSourceBestellingInhoud" ForeColor="#333333" 
192                      GridLines="None" onrowediting="GridView2_RowEditing" Visible="False">
193                      <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
194                      <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
195                      <Columns>
196                          <asp:CommandField ShowDeleteButton="True" ShowEditButton="True" />
197                          <asp:BoundField DataField="BestellingID" HeaderText="BestellingID" 
198                              ReadOnly="True" SortExpression="BestellingID" />
199                          <asp:BoundField DataField="ArtikelID" HeaderText="ArtikelID" ReadOnly="True" 
200                              SortExpression="ArtikelID" />
201                          <asp:BoundField DataField="Aantal" HeaderText="Aantal" 
202                              SortExpression="Aantal" />
203                      </Columns>
204                      <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
205                      <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
206                      <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
207                      <EditRowStyle BackColor="#999999" />
208                      <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
209                  </asp:GridView>
210                  <asp:ObjectDataSource ID="ObjectDataSourceBestellingInhoud" runat="server" 
211                      DeleteMethod="Delete" InsertMethod="Insert" 
212                      OldValuesParameterFormatString="original_{0}" 
213                      SelectMethod="GetBestellingInhoudByBestellingID" 
214                      TypeName="webshopTableAdapters.BestellingInhoudTableAdapter" 
215                      UpdateMethod="Update">
216                      <DeleteParameters>
217                          <asp:Parameter Name="Original_BestellingID" Type="Int32" />
218                          <asp:Parameter Name="Original_ArtikelID" Type="Int32" />
219                          <asp:Parameter Name="Original_Aantal" Type="Int32" />
220                      </DeleteParameters>
221                      <UpdateParameters>
222                          <asp:Parameter Name="Aantal" Type="Int32" />
223                          <asp:Parameter Name="Original_BestellingID" Type="Int32" />
224                          <asp:Parameter Name="Original_ArtikelID" Type="Int32" />
225                          <asp:Parameter Name="Original_Aantal" Type="Int32" />
226                      </UpdateParameters>
227                      <SelectParameters>
228                          <asp:ControlParameter ControlID="GridView1" Name="BestellingID" 
229                              PropertyName="SelectedValue" Type="Int32" />
230                      </SelectParameters>
231                      <InsertParameters>
232                          <asp:Parameter Name="BestellingID" Type="Int32" />
233                          <asp:Parameter Name="ArtikelID" Type="Int32" />
234                          <asp:Parameter Name="Aantal" Type="Int32" />
235                      </InsertParameters>
236                  </asp:ObjectDataSource>
237              </td>
238          </tr>
239      </table>
241  </asp:Content>
11/4/2008 12:49:05 PM 72751 articles. 3 followers. Follow

8 Replies

Similar Articles

[PageSpeed] 56
Get it on Google Play
Get it on Apple App Store

You should be doing this via the code-behind. What happens when you try to edit?

Thanks, Ed

Microsoft MVP - ASP/ASP.NET

11/4/2008 1:22:11 PM
I don't know how to do this, I don't have any code in my "GridView2_RowEditing" method yet... 
What I have so far is that I can show data in my GridView2 using following code:
1    protected void GridView1_SelectedIndexChanged(object sender, EventArgs e)
2    {
3      GridView gridview = (GridView) sender;
4      int ID = (int) gridview.SelectedValue;
6      webshopTableAdapters.OrderContentTableAdapter OrderContentTableAdapter = new webshopTableAdapters.OrderContentTableAdapter();
7      DataTable dt = OrderContentTableAdapter.GetOrderContentByID(ID);
9      if (dt.Rows.Count != 0){
10       GridView2.DataBind();
11       GridView2.Visible = true;
12     }
13     else
14       GridView2.Visible = false;
15   }
Also, I still have my ObjectDataSource like in my previous post. With the code behind my "GridView1_SelectedIndexChanged" and my ObjectDataSource, GridView2 gets populated and when I select 'edit' it gets editable.
When I click update however, it doesn't save the data. It just keeps the value it had before I started updating.
11/5/2008 11:57:29 AM

All you should have to do within your SelectedIndexChanged handler is to call the DataBind method of GridView2. The ObjectDataSource will handle the rest. If you need to be able to hide the GridView, then do this within the ObjectDataSource.Selected event handler.

Thanks, Ed

Microsoft MVP - ASP/ASP.NET

11/5/2008 1:03:55 PM

 When I remove all my code out of the GridView1_SelectedIndexChanged method and just leave in "Gridview2.DataBind", nothing happens when I select a row from my gridview1.
The ObjectDataSource bound to my gridview2 is still set up the same as in my first post.

Any idea's why this doesn't work?

11/5/2008 4:28:27 PM

My apologies, I was a bit to hasty. Smile I forgot to turn on the gridview2 's visibility, so obviously I didn't see any results. Smile

Like you said, only the databind() method is needed for gridview2 to show what I want.

The fields also get editable when I click "edit" on my gridview2, but when I say "update" it doesn't update. The edited field just reverts to its old value.
I tried putting the databind() method in the GridView2_RowEditing method, but that doens't cut it.

Any suggestions?




11/5/2008 4:52:12 PM

Hi Grizly ,

I don't think you need to write any code when you connect GridView with objectdatasource.

You said you forget to turn on the gridview2's visibility, so try to remove the databind() method.

If you put one break point in Update( int Aantal,int Original_BestellingID, int Original_ArtikelID, int Original_Aantal ) method , does it retrieve the correct value ? I think it should work , these parameters begin with Original will get original value and the Aantal parameter will retrieve new value !



Samu Zhang
Microsoft Online Community Support

Please remember to click “Mark as Answer” on the post that helps you, and to click “Unmark as Answer” if a marked post does not actually answer your question.
11/6/2008 7:22:54 AM

 Hi Samu Zhang

You're right about the fact that I can just leave out the databind() method in my gridview1_selectedIndexChanged() method.  I thought this was necessary because when I load my page, there is no row selected and so the objectdatasource bound to my detailsview2 doesn't get any data making it necessary to databind everytime a row got selected in my gridview1.

Which Update method do you mean? The "Updated" / "Updating" method of my ObjectDataSource2 or the "RowUpdating" / "RowUpdated" method of my GridView2?

Right now I thought I needed to write "databind();" in my gridview2_rowEDITING method, but this isn't the case then I guess.




11/8/2008 7:43:53 AM

I fixed it Smile Don't ask me how... But it just checked everything in my DataSet and ObjectDataSource and it just works now... Really bizarre... But nevertheless, great Stick out tongue




11/8/2008 8:29:56 PM

Similar Artilces:

TabContainer's height doesn't respecting child GridView's height
Well, it's not that complex:I have a TabContainer with 4 tabs. In the first 2 I have different GridViews, but I'm actually only working with the first one.There's no UpdatePanel, no crazy situations, it's a simple GridView with an associated ObjectDataSource, wich will DataBind the GridView in every PostBack (yes, normal, simple, server-side PostBack) based on the value of a TextBox. And this value is only changed on the click of a ImageButton. All of this happens on the Server side.BUT, in the initial load of the page, the GridView is empty, as is the TabPanel. After the fir...

Replace 1's and 0's in a gridview column with Yes's and No's
Is it possible to change the display of a column in a gridview to show a Yes for all 1's and a No for 0's that display in a particular column of a gridview bound to a database?  If so, can someone share the way with me?  I am using ASP.NET 2.0 with VB Code Behind.  Thanks One way you can do is thrrough  CASE in your select statement: Select YesNoColumn= CASE yourColumn WHEN 1 THEN 'Yes' WHEN 0 THEN 'No' ELSE '' END FROM YourtableLimno <Columns>     <asp:TemplateField HeaderText="yourHeader" SortExpression="yourDataField"> ...

Label control's text doesn't appear to be set (in the page which has a user control )when trying to update the text property in the FormView's ItemUpdated event
Hi There,I have a user control which hosts a formview control, gridview control and a label control. The grid view is usedto show rows in the DB and when clicked to edit each row, a form view opens up in edit mode with that particular row info. So I have nothing in the item template.My first question it mandatory to have smth in the itemtemplate of the form view.I have controls in edititemtemplate and insertitemtemplate.When a particular row is edited, I would like to show a status msg showing that the row has been updated.For this, I use the ItemUpdated event of the formview and try ...

What's wrong with DataBind() in GridView control? The data in GridView can't be updated when the datasource have changed!
What's wrong with DataBind() in GridView control? The data in GridView can't be updated when the datasource have changed! I bind the different datasource to the Gridview when I change the node of TreeView, the GridView control always display the same data when I click different the node of TreeView control,why?but I can get the different data in GridView when I click the Button1 or Button2. //-------------------Program Code (You may save it as a ASPX file and run it)--------------------------------<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http:/...

GridView doesn't refresh it's schema after the object data source's GetData() method returns additional fields .
Hi . I am creating an ASP.NET web site and have the following problem :  I have a GridView which bound to the object data source. This object data source is SQL Table adapter that I added to the data set via IDE . The method GetData of this table adapter uses existing stored procedure on my SQL 2005 server. Everything worked fine , until I made a changes to the stored procedure ( the new result records have additional fields )  .  The problem is :   The new fields don’t appear in the grid . Note : When I right click to the GetData method inside the tabl...

'Tab' control 's visible doesn't work.Why?
I use tab control in my applition. And I set visible=false, but it doesn't work. my code is: ----------------------------------------------- <asp:ScriptManager ID="ScriptManager1" runat="server" />  <div>   <ajaxToolkit:TabContainer runat="server" ID="Tabs" Height="138px" ActiveTabIndex="0"    Width="402px">    <ajaxToolkit:TabPanel runat="server" ID="Panel1" HeaderText="Tab1" Visible="f...

sorting doesn't work when editing gridview's row
 Hi, I have implemented a GridView's sorting and editing manually and they both work seperately, but not together. If I sort then try to edit one of the sorted records, the GridView edits a row on the first page that corresponds to the location of the edited row. In other words, the page loses sorting, when the edit button is clicked and the wrong row is edited.Any suggestions will be very much appreciated.E Hi Ennair , Here is one sample,   <form id="form1" runat="server"> <div> <asp:GridView ID="gvUsers" r...

How to make the DetailsView's edit button visible according to the state of one field of a GridView's selected row?
Hello everyone! Now I am working with a Master/Detail page that using a gridview and a detailsview. The detailsview is set to editable and the edit button is autogenerated. I want to make the DetailsView's edit button visible according to the state of one field of a GridView's selected row. I tried to access the selected row of the gridview in the detailsview's ItemCreated event or DataBound event,using the following code GridViewRow row = gvwMaster.SelectedRow But it goes wrong with this line of code. And then I tried to write some code in the gridview's SelectedIndexChanged eve...

the option for obtaining info on the new update ('what's new')doesn't work
Name: Product: Firefox Summary: the option for obtaining info on the new update ('what's new')doesn't work Comments: See Summary - no link opens, neither by clicking nor right clicking - seems like it's a dead link and one that would be quite important Browser Details: Mozilla/5.0 (Windows; U; Windows NT 6.0; en-US; rv: Gecko/20091201 Firefox/3.5.6 (.NET CLR 3.5.30729) From URL: Note to readers: Hendrix gives no expectation of a response to this feedback but if you wish to provide one you must BCC (not CC) the sender for them to see it. ...

How to 'reset' the 'selected' status of a Gridview row?
Hi all, I have a girdview with selection enabled. BEsides, when the 'select' button is pressed, the row style will change. My problem is, when the user selected a row, then (for whatever reason) the gridview is refreshed (with a databind command), the selected row is still shown to be 'selected' (i.e. with the selectedRowStyle still applied) after the databind.  How can I make the selected row to become an ordinary/ non-selected row after databinding?Thanks Tony well for that u have to write a Client side function ..and stop the grid from doing post back.. u s...

binding second table's column's value to the gridview how?
Hi,Im using stored procedure like this:create proc selectimageandPosting  @uName nvarchar(256)  as  begin  select postingid,imageid,location, modelno, condition, description1,description2,years,months,days,price,negotiable,username,timeofposting from posting where username=@uName  select imageurl from productimage where id=(select imageid from posting where username=@uName)  end  which gives me right o/p in query analyzer now in code behind i've written:            con.Open()  &nbs...

superreview requested: [Bug 280713] ContinueInterruptedParsing doesn't set the current context's scanner's mIncremental member correctly : [Attachment 173997] updated to review comments
Blake Kaplan <> has asked Boris Zbarsky <> for superreview: Bug 280713: ContinueInterruptedParsing doesn't set the current context's scanner's mIncremental member correctly Attachment 173997: updated to review comments ...

superreview granted: [Bug 280713] ContinueInterruptedParsing doesn't set the current context's scanner's mIncremental member correctly : [Attachment 173997] updated to review comments
Boris Zbarsky <> has granted Blake Kaplan <>'s request for superreview: Bug 280713: ContinueInterruptedParsing doesn't set the current context's scanner's mIncremental member correctly Attachment 173997: updated to review comments ------- Additional Comments from Boris Zbarsky <> sr=bzbarsky. Land this either _really_ early in 1.8b2 or in 1.9a.... ...

second update panel's hidden field data loses when first update panel's procedure clicked
I am using v2.0 - my ajax enable web site have 2 update panels 1st Update panel updates a hidden field placed in the 2nd update panel - ok hiden fild is get updated edit procedure associated with in the first update panel then again try to read the value from the hidden field (it is database editing procedure, the hidden filed contain the Primary key). but when the edit procedure is clicked, hidden filed looses the data, the following event is get called when edit_procedure() is clicked Protected Sub hfTenantId_ValueChanged(ByVal sender As Object, ByV...

Web resources about - First gridview's selected row doesn't update second gridview's objectdatasource -

Forums Forums Database Error
This is a discussion forum powered by vBulletin. To find out about vBulletin, go to .

Using The LINQDataSource
-*+There is a new datasource control available in Visual Studio that works in much the same way as the SQLDataSource and the ObjectDataSource. ...

ASP.NET Web Forms DynamicData FieldTemplates for DbGeography Spatial Types
... a FormView in ASP.NET Web Forms. Notice the ItemType is set, rather than using Eval(). We're also using SelectMethod rather than an ObjectDataSource. ...

LINQ Tutorials : LINQ Tutorials, Articles and Resources
Articles and Helpful Tutorials for LINQ and ASP.NET

About Mikesdotnetting
I started this site as somewhere to store answers to bits and pieces that I see asked frequently in the forums at . Rather than type ...

Runnable code for JQuery, Codeigniter, NodeJS, PHP, Python and more - Runnable
Runnable code for dart-vm, express, paypal, google, evernote, everyauth, ejs, rendr, CakePHP, php-mysql, php-facebook, codeigniter, imagemagick, ...

ASP.NET Pivot Table - RadPivotGrid for ASP.NET AJAX
... of all data reports. Try now! Use any declarative data source control (AccessDataSource, SqlDataSource, LinqDataSource, EntityDataSource, ObjectDataSource, ...

Miscellaneous « AJ\’s blog
AJ\’s blog January 28, 2012 2011 in review Filed under: Miscellaneous — ajdotnet @ 7:41 pm The stats helper monkeys prepared a ...

ObjectDataSource - Selectcount method with custom parameters and custom paging.
protected void obds_Selecting(object sender, ObjectDataSourceSelectingEventArgs e) { if (!e.ExecutingSelectCount) { e.InputParameters["filter"] ...

Archive - Forever Breathes The Lonely Word

Resources last updated: 1/17/2016 7:09:07 AM