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

[Solved] Unable to get the datavalue from GridHyperLinkColumn

1 Answer 92 Views
Grid
This is a migrated thread and some comments may be shown as answers.
Kaushik Subramanya
Top achievements
Rank 1
Kaushik Subramanya asked on 02 Sep 2009, 08:30 PM
Hello,
I am currently evaluating RadGrid and am looking towards some Gurus for some help

I have a created a radgrid which takes data from a table and displays it in rows. One of the columns is a  GridHyperLinkColumn which is also the DataKeyName Column

ASPX Code
<MasterTableView EditMode=InPlace DataKeyNames="UniqueId">
                         <Columns>
                             <telerik:GridBoundColumn DataField="ContractNo"
                                 HeaderText="Contract Number" UniqueName="ContractNo">
                                 <FooterStyle Font-Bold="True" />
                                 <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                                     Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                                     Wrap="True" />
                                 <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                                     Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                                     Wrap="True" />
                             </telerik:GridBoundColumn>
                             <telerik:GridHyperLinkColumn DataNavigateUrlFields="UniqueId,RevisionNo"
                                 DataNavigateUrlFormatString="URL"~/UpdateDetail.aspx?UniqueId={0}&amp;RevisionNo={1}&amp;"
                                 DataTextField="UniqueId" HeaderText="Unique ID" UniqueName="UniqueId">
                                 <HeaderStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                                     Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                                     Wrap="True" />
                                 <ItemStyle Font-Bold="False" Font-Italic="False" Font-Overline="False"
                                     Font-Strikeout="False" Font-Underline="False" HorizontalAlign="Center"
                                     Wrap="True" />
                             </telerik:GridHyperLinkColumn>
          </Columns>
</MasterTableView>

.CS Code

protected

 

void gvrgPendingWorkflow_UpdateCommand(object source, GridCommandEventArgs e)

 

{

 

GridEditableItem editedItem = e.Item as GridEditableItem;

 

 

//Get the primary key value using the DataKeyValue.

 

 

string sUniqueID = editedItem.OwnerTableView.DataKeyValues[editedItem.ItemIndex]["UniqueID"].ToString();

 

 


//Access the textbox from the edit form template and store the values in string variables.

 

 

string sContractNo = (editedItem["ContractNo"].Controls[0] as TextBox).Text;

 

 

string sRevisionNo = (editedItem["RevisionNo"].Controls[0] as TextBox).Text;

 

}

I am getting the following error when i am trying to read sUniqueID 
"Object reference not set to an instance of an object"

However if I comment that single line I am able to read the updated values entered for sContractNo and sRevisionNo

Please advise.

Your help is much appreciated.

Regards,
Kaushik

1 Answer, 1 is accepted

Sort by
0
Pavlina
Telerik team
answered on 04 Sep 2009, 01:55 PM
Hello Kaushik,

It seems that you have opened a other ticket for an identical issue. To avoid duplicate posts, we can continue our communication there.

Sincerely yours,
Pavlina
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
Kaushik Subramanya
Top achievements
Rank 1
Answers by
Pavlina
Telerik team
Share this question
or