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}&RevisionNo={1}&"
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
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
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}&RevisionNo={1}&"
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