meenakshidhar
Programmer
Hi All,
I have one Reapeter in my page. I have to use two seperate stored procedures in order to fetch the data from database and then bind it to the data repeater.
My code is given below--
<asp:Repeater id="Repeater1" runat="server">
<HeaderTemplate>
<table border="1">
<tr bgcolor="#C8CCE1">
<th>First Name</th>
<th>Extension No</th>
<th>Mobile No</th>
<th>Email</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#F5F7FA">
<td><%# DataBinder.Eval(Container.DataItem, "FIRST_NAME") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "LAST_DIGITS") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "?????") %></td> ---(This field is coming from second query i.e. another stored procedure)
<td><%# DataBinder.Eval(Container.DataItem, "RESOURCE_INITIAL") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
============================================================
Private Sub Page_Load()
If Not Page.IsPostBack Then
Dim objTel As New clsTelephoneList()
Dim DS As New DataSet()
DS = objTel.fnCompany_Listing()
Repeater1.DataSource = DS
Repeater1.DataBind()
End If
End Sub
============================================================
Public Class clsTelephoneList
Public Function fnCompany_Listing()
Dim objConn As New db_Globals()
Dim cmd As New SqlCommand()
Try
cmd = objConn.GTDConn("spTelephone_Listing")
cmd.ExecuteNonQuery()
Dim DA As New SqlDataAdapter(cmd)
Dim DS As New DataSet()
DA.Fill(DS)
Return DS
Catch ex As Exception
Throw New ArgumentException(ex.Message.ToString())
Finally
cmd.Connection.Close()
End Try
End Function
End Class
=============================================================
Public Class db_Globals
Function GTDConn(ByVal vchSPName)
Dim sConnectionString As String = "server=INFO3783;uid=gtd;pwd=gtd;database=GTD"
Dim conn As New SqlConnection(sConnectionString)
Dim cmd As New SqlCommand(vchSPName, conn)
Try
cmd.Connection.Open()
cmd.CommandType = CommandType.StoredProcedure
Return cmd
Catch ex As Exception
Throw New ArgumentException(ex.Message.ToString())
End Try
End Function
End Class
============================================================
Now my problem is to bind 1st, 2nd and 4th field from one stored procedure and 3rd field from another stored procedure. Is this possible using Data Repeater..if not, what will be the right approach to achieve this....
Thanks in Advance,
Meenakshi Dhar
I have one Reapeter in my page. I have to use two seperate stored procedures in order to fetch the data from database and then bind it to the data repeater.
My code is given below--
<asp:Repeater id="Repeater1" runat="server">
<HeaderTemplate>
<table border="1">
<tr bgcolor="#C8CCE1">
<th>First Name</th>
<th>Extension No</th>
<th>Mobile No</th>
<th>Email</th>
</tr>
</HeaderTemplate>
<ItemTemplate>
<tr bgcolor="#F5F7FA">
<td><%# DataBinder.Eval(Container.DataItem, "FIRST_NAME") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "LAST_DIGITS") %></td>
<td><%# DataBinder.Eval(Container.DataItem, "?????") %></td> ---(This field is coming from second query i.e. another stored procedure)
<td><%# DataBinder.Eval(Container.DataItem, "RESOURCE_INITIAL") %></td>
</tr>
</ItemTemplate>
<FooterTemplate>
</table>
</FooterTemplate>
</asp:Repeater>
============================================================
Private Sub Page_Load()
If Not Page.IsPostBack Then
Dim objTel As New clsTelephoneList()
Dim DS As New DataSet()
DS = objTel.fnCompany_Listing()
Repeater1.DataSource = DS
Repeater1.DataBind()
End If
End Sub
============================================================
Public Class clsTelephoneList
Public Function fnCompany_Listing()
Dim objConn As New db_Globals()
Dim cmd As New SqlCommand()
Try
cmd = objConn.GTDConn("spTelephone_Listing")
cmd.ExecuteNonQuery()
Dim DA As New SqlDataAdapter(cmd)
Dim DS As New DataSet()
DA.Fill(DS)
Return DS
Catch ex As Exception
Throw New ArgumentException(ex.Message.ToString())
Finally
cmd.Connection.Close()
End Try
End Function
End Class
=============================================================
Public Class db_Globals
Function GTDConn(ByVal vchSPName)
Dim sConnectionString As String = "server=INFO3783;uid=gtd;pwd=gtd;database=GTD"
Dim conn As New SqlConnection(sConnectionString)
Dim cmd As New SqlCommand(vchSPName, conn)
Try
cmd.Connection.Open()
cmd.CommandType = CommandType.StoredProcedure
Return cmd
Catch ex As Exception
Throw New ArgumentException(ex.Message.ToString())
End Try
End Function
End Class
============================================================
Now my problem is to bind 1st, 2nd and 4th field from one stored procedure and 3rd field from another stored procedure. Is this possible using Data Repeater..if not, what will be the right approach to achieve this....
Thanks in Advance,
Meenakshi Dhar