Link to home
Start Free TrialLog in
Avatar of Shiva_Kumar
Shiva_Kumar

asked on

dotnetnuke module to populate datbase contents dynamically

Hi,

I am new to asp.net and dotnetnuke.
I have created a dotnetmodule which pulls the data from the database and populates the contents in the gridview.  I need to make the contents of the gridview clickable in such a manner that it should populate another set of data onto another gridview control.

the table (softwares) schema is something like this

Product      version    Comaptiblity

abc            1.0           winxp
xyz            2.0           vista
abc            2.0           vista
xyz            3.0           winxp

onload i am able to populate the products and now what i need is when somebody clicks on the product (say abc) it should populate the versions available on the second gridveiw control.


===============================test.ascx======================================
<%@ Control Language="VB" AutoEventWireup="false" CodeFile="Test.ascx.vb" Inherits="DesktopModules_Test_Test" %>
Search:&nbsp;
<asp:TextBox ID="txtSearch" runat="server"></asp:TextBox>&nbsp;
<asp:Button ID="btnSearch" runat="server" Text="Button" /><br />
<br /> 
<table><tr>
<td style="height: 154px">
<div class ="style5">
<asp:GridView ID="GridView1" runat="server">
</asp:GridView>
    &nbsp;&nbsp;
</div>
</td>
<td style="height: 154px">
<div class ="style5">
<asp:GridView ID="GridView2" runat="server">
</asp:GridView>
    &nbsp;&nbsp;
</div></td>
</tr>
</table>
===============================test.ascx.vb===================================
Imports DotNetNuke
Imports System.Web.UI
Imports System.Collections.Generic
Imports System.Reflection
Imports DotNetNuke.Security.PortalSecurity
 
Partial Class DesktopModules_Test_Test
    Inherits DotNetNuke.Entities.Modules.PortalModuleBase
 
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        If Not Page.IsPostBack Then
          ' this function shows the available products on load
            ShowData("Product")
        End If
 
    End Sub
    Protected Sub btnSearch_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnSearch.Click
        ShowData(txtSearch.Text)
    End Sub
    Private Sub ShowData(ByVal SearchString As String)
        Dim mySqlString As New StringBuilder()
        mySqlString.Append("SELECT DISTINCT ")
        mySqlString.Append(SearchString)
        mySqlString.Append(" FROM Softwares ")
        Dim myParam As SqlParameter = New SqlParameter("@SearchString", SqlDbType.VarChar, 150)
        myParam.Value = SearchString
        Me.GridView1.DataSource = CType(DataProvider.Instance().ExecuteSQL(mySqlString.ToString(), myParam), IDataReader)
        Me.GridView1.DataBind()
    End Sub
  
End Class

Open in new window

Avatar of Shiva_Kumar
Shiva_Kumar

ASKER

Do I have any Suggestions?
ASKER CERTIFIED SOLUTION
Avatar of paololabe
paololabe
Flag of Italy image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Perfect!