This is a migrated thread and some comments may be shown as answers.

How to find unique id for an entry in a given radgrid in .aspx page.

2 Answers 230 Views
Grid
This is a migrated thread and some comments may be shown as answers.
pawan parashar
Top achievements
Rank 1
pawan parashar asked on 15 Dec 2009, 11:17 AM
Hi ,
I have used a radgrid for selecting and displaying the data from SQL DB. I got stuck up at this point with the below problem:

1) I am retrieving the data from DB using selectcommand in .aspx page.
<asp:SqlDataSource ID="SqlDataSource1" runat="server"   
            ConnectionString="<%$ ConnectionStrings:TestMangerConnectionString %>"   
            SelectCommand="SELECT Component_Table.Component as Component,Bug_Count_Bucket_Wise.E2ECount_Total as Total,Bug_Count_Bucket_Wise.E2ECount_Active as Active,Bug_Count_Bucket_Wise.E2ECount_Closed as Fixed,Bug_Count_Bucket_Wise.E2ECount_Resolved as Resolved,Track_Table.ETA as ETA,Track_Table.Comments as Comments
FROM Bug_Count_Bucket_Wise,Component_Table,Track_Table,Type_of_Bucket,TL_Details,TM_Details
WHERE 
Component_Table.CompID=Bug_Count_Bucket_Wise.CompID  
AND Bug_Count_Bucket_Wise.CompID=Track_Table.CompID
AND TM_Details.TMID = TL_Details.TMID 
AND TL_Details.ID=Component_Table.TLID
AND Type_of_Bucket.ID = Track_Table.BucketID
AND TM_Details.TMAlias=@TM
AND Type_of_Bucket.Type= 'AHI'"   
              
            UpdateCommand="UPDATE Track_Table 
SET Track_Table.ETA = @ETA,Track_Table.Comments= @comments,Track_Table.Modified_Date=  @CurrentTime,Track_Table.Edit_Alias=@LoginUser
FROM Bug_Count_Bucket_Wise,Component_Table,Track_Table,Type_of_Bucket,TL_Details,TM_Details
WHERE 
Component_Table.CompID=Bug_Count_Bucket_Wise.CompID  
AND Bug_Count_Bucket_Wise.CompID=Track_Table.CompID
AND TM_Details.TMID = TL_Details.TMID 
AND TL_Details.ID=Component_Table.TLID
AND Type_of_Bucket.ID = Track_Table.BucketID
AND TM_Details.TMAlias=@TM
AND Type_of_Bucket.Type= 'AHI'
AND Component_Table.Component = ??????">  
             <SelectParameters>  
                 <asp:CookieParameter CookieName="TM" Name="TM" Type="String" DbType="Object" />  
             </SelectParameters>  
              
             <UpdateParameters>  
             <asp:Parameter Name="ETA" Type="DateTime" />  
             <asp:Parameter Name="Comments" Type="String" />  
             <asp:CookieParameter CookieName="CurrentTime" Name="CurrentTime" Type="DateTime" DbType="Object" />  
             <asp:CookieParameter CookieName="LoginUser" Name="LoginUser" Type="String" DbType="Object" />  
             <asp:CookieParameter CookieName="TM" Name="TM" Type="String" DbType="Object" />  
               
             <asp:Parameter Name="Component" Type="String" />  
               
                  
</UpdateParameters>  
 
              
   </asp:SqlDataSource> 

2) I am updating the same using above query in .aspx page.

The user can edit a field of the table/grid by clicking on the edit button. As it can be seen in the update querry above, the ETA and the Comment fields are editable and once the changes are done , the update button is clicked.

After this the table should be refreshed with the new changes which have just been incorporated by the user. The issue arises when the update button is clicked.
 The changed data is being fetched from the DB but the, ETA and comments fields in each row of the new table generated, now contain the changed/updated values.

This is because we are unable to identify the row which has been changed, with a unique ID.

I would like to know,how to identify a row uniquely in a given update querry in aspx.

Kindly refer to the "?????????" in the query posted above in .aspx.

I would like to know how to extract a given field of a radgrid. For instance, the background id associated with "Print" , which is the value in the first row, first column of the grid.  (please refer the screenshot attached) .

This value/unique id, should now be substituted for the "??????" in the above querry.





2 Answers, 1 is accepted

Sort by
0
pawan parashar
Top achievements
Rank 1
answered on 16 Dec 2009, 06:45 AM
Can some one please solve my problem.
0
Mira
Telerik team
answered on 18 Dec 2009, 11:21 AM
Hi Pawan,

Please take a look at the Automatic DataSource operations help topic and demo to see how the desired by you functionality can be implemented.
You should add the value of the Component_Table.Component as a update parameter of the data source.
For more information on different ways to update values, please examine the Updating values in-place and with edit forms help topic.

Additionally, I would also like to ask you whether you have the Component added to the DataKeyNames of  the grid.

Greetings,
Mira
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
Tags
Grid
Asked by
pawan parashar
Top achievements
Rank 1
Answers by
pawan parashar
Top achievements
Rank 1
Mira
Telerik team
Share this question
or