Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
180
Accessing control in template
posted

I can't seem to find any examples of accessing a control in a template from code-behind. My grid is bound to a dataset, and the bound data fields display fine. I want to have a hyperlink in one of the parent columns, however, so I did this:

<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGrid1" DataKeyFields="T$ORNO,T$ITEM" AutoGenerateBands="false" AutoGenerateColumns="false" runat="server" Height="350px" Width="800px">
      <
Columns>
            <
ig:TemplateDataField Header-Text="RMA" Key="T$ORNO,T$ITEM">
                  <
ItemTemplate>
                        <
asp:HyperLink ID="lnkRMA" runat="server" />
                  </
ItemTemplate>
            </
ig:TemplateDataField>
            <
ig:BoundDataField DataFieldName="T$PRDI" Key="T$PRDI" Header-Text="Product" />
      </
Columns>

If I was using a standard GridView control, I would set the Hyperlink properties in my code-behind like this:

Protected Sub GridView1_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GridView1.RowDataBound

      Dim itemType As ListItemType = CType(e.Row.RowType, ListItemType)

      If itemType = ListItemType.Item Or itemType = ListItemType.AlternatingItem Then

      Dim drv As DataRowView = CType(e.Row.DataItem, DataRowView)

      Dim lnkRMA As HyperLink = CType(e.Row.FindControl("lnkRMA"), HyperLink)

      lnkRMA.Text = drv("T$ORNO").ToString & "." & drv("T$ITEM").ToString

etc.

How do I accomplish the same thing with the WHDG? Which event would I use?

 

Parents Reply Children
No Data