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
80
fill template field with data from ObjectDataSource
posted

 

 

Sorry, i'm new here. I got a problem in my first time use HierarchicalDataGrid

The problem is, when i use item template is WHDG,

how can i  make the data to be dynamic.

 

Here is my code

<ig:WebHierarchicalDataGrid ID="WebHierarchicalDataGridAuditor" runat="server" Height="500px"
Width="700px" AutoGenerateBands="False" AutoGenerateColumns="False"
DataKeyFields="IdJdw" DataMember="ObjectDataSourceAuditorDep_DefaultView"
DataSourceID="WebHierarchicalDataSourceAuditor"
Key="ObjectDataSourceAuditorDep_DefaultView">
<Columns>
   
<ig:BoundDataField DataFieldName="Nama_dep" Key="Nama_dep">
<Header Text="Unit / Departemen" />
</ig:BoundDataField>

<ig:TemplateDataField Key="Action" Width="60px">
<ItemTemplate>


<asp:HyperLink ID="hlAction" runat="server">add temuan</asp:HyperLink>

</ItemTemplate>
</ig:TemplateDataField>
</Columns>
  <Bands>
<ig:Band AutoGenerateColumns="False"
DataMember="ObjectDataSourceAuditorAuditor_DefaultView"
Key="ObjectDataSourceAuditorAuditor_DefaultView">
  <Columns>
<ig:BoundDataField DataFieldName="NamaAuditor" Key="NamaAuditor">
<Header Text="Auditor" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="JabatanAuditor" Key="JabatanAuditor">
<Header Text="Jabatan Auditor" />
</ig:BoundDataField>
<ig:BoundDataField DataFieldName="NamaJenis" Key="NamaJenis">
<Header Text="Role" />
  </ig:BoundDataField>
</Columns>
</ig:Band>
<ig:Band AutoGenerateColumns="False"
DataMember="ObjectDataSourceAuditorAuditee_DefaultView"
  Key="ObjectDataSourceAuditorAuditee_DefaultView">   
</ig:Band>
</Bands>
</ig:WebHierarchicalDataGrid>

<ig:WebHierarchicalDataSource ID="WebHierarchicalDataSourceAuditor"
runat="server">
  <DataRelations>
<ig:DataRelation ChildColumns="IdJdw"
ChildDataViewID="ObjectDataSourceAuditorAuditor_DefaultView"
ParentColumns="IdJdw"
  ParentDataViewID="ObjectDataSourceAuditorDep_DefaultView" />
</DataRelations>
<DataViews>
<ig:DataView ID="ObjectDataSourceAuditorDep_DefaultView"
  DataMember="DefaultView" DataSourceID="ObjectDataSourceAuditorDep" />
<ig:DataView ID="ObjectDataSourceAuditorAuditor_DefaultView"
  DataMember="DefaultView" DataSourceID="ObjectDataSourceAuditorAuditor" />   
</DataViews>
</ig:WebHierarchicalDataSource>
<asp:ObjectDataSource ID="ObjectDataSourceAuditorAuditee" runat="server"
SelectMethod="GetAuditeeJadwal" TypeName="BusinessFacade.AuditScheduleSystem">
<SelectParameters>
<asp:ControlParameter ControlID="tahun" Name="tahun" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="periode" Name="periode" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>
<asp:ObjectDataSource ID="ObjectDataSourceAuditorAuditor" runat="server"
SelectMethod="GetAuditorJadwal" TypeName="BusinessFacade.AuditScheduleSystem">
<SelectParameters>
<asp:ControlParameter ControlID="tahun" Name="tahun" PropertyName="Text"
Type="String" />
<asp:ControlParameter ControlID="periode" Name="periode" PropertyName="Text"
Type="String" />
</SelectParameters>
</asp:ObjectDataSource>

The code that shown above is succesfull created.

The problem is, how can i fill attribute 'NavigateUrl' in my hyperlink with Primary Key(or some data) from my ObjectDataSource

for easy example is, i make the label in item template, then how to fill it with data from ObjectDataSource

(very good solving if it can fixed in my code behind (C# recommended) )

Thx for helping, and I'm sorry if my english not good. :p

Parents
No Data
Reply
  • 29417
    Verified Answer
    Offline posted

    Hello eveex ,

     

    I know it has been a while since you posted your question but if you still need assistance with this issue I’d be glad to offer some.

     

    You can access the HyperLink in the Initialize row event like this:

     

    protected void WebHierarchicalDataGrid1_InitializeRow(object sender, Infragistics.Web.UI.GridControls.RowEventArgs e)

        {

            HyperLink myhyperlink =(HyperLink) e.Row.Items[0].FindControl("link");

      

        }

    And manipulate it’s content (NavigateUrl property) any way you’d like.

     

    If you have further questions regarding this issue don’t hesitate to ask.

     

    Best Regards,

    Maya Kirova

    Developer Support Engineer

    Infragistics, Inc.

    http://ko.infragistics.com/support

     

Children