C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Communities   Interview   Jobs   Projects   Training   ASP.NET Web Hosting    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...

Play Silverlight Games or Submit your Silverlight applications and earn 90% AdSense revenue.

New Feature: Community Sites: Create your own .NET community website and start earning from Google AdSense ! It's Free !




Forums » .NET » ASP.NET »

Very urgent task in ASP.Net !!!!!!!!!!!!!!!


Posted Date: 29 Nov 2008      Posted By: Komathi      Member Level: Silver     Points: 1   Responses: 1



This is my ASP.Net code...In my dropdownlist drpCustomer.Items.Add(dtCust.Rows(iRole)("RepofCustomer"))

The values didn't loaded in dropdownlist...what is the problem??? I dont know.any one know the answer pls help me.it's very urgent


<tr>
<td style ="color :Black"align ="right">
Role:
</td >
<td style="width: 291px"align ="left"><select id="drpRole" runat ="server" style="width: 203px" onchange ="LoadCustomer();" ><option value="ini">----Select----</option></select></td>
</tr>

<tr>
<td style ="color :Black"align ="right">
Representative of Customer:
</td >
<td style="width: 291px"align ="left"><select id="drpCustomer" runat ="server" style="width: 205px" ></select></td>
</tr>

<tr>




function LoadCustomer()
{
var sRoleName =document.getElementById("drpRole").value;
AjaxPro.timeoutPeriod = 30000;
AjaxArea.getRepValue(sRoleName);
}



<AjaxPro.AjaxMethod(AjaxPro.HttpSessionStateRequirement.ReadWrite)> Public Function getRepValue(ByVal sRoleValue As String)
With HttpContext.Current
Dim iRow As Integer
Dim iRoleId As Integer
Dim iRole As Integer
Dim con As SqlConnection = Connection.OpenConnection
Dim daSelect As SqlDataAdapter = New SqlDataAdapter("Select * from Roles where Roles='" & sRoleValue & "'", con)
Dim dsSelect As New DataSet
Dim dtSelect As New DataTable
daSelect.Fill(dsSelect)
dtSelect = dsSelect.Tables(0)
For iRow = 0 To dtSelect.Rows.Count - 1
iRoleId = dtSelect.Rows(iRow)("Role_Id")
Next
If iRoleId <> 0 Then
' drpCustomer.Items.Clear()
Dim daCust As SqlDataAdapter = New SqlDataAdapter("Select * from CustomerDetail where Role_Id=" & iRoleId & "", con)
Dim dsCust As New DataSet
Dim dtCust As New DataTable
daCust.Fill(dsCust)
dtCust = dsCust.Tables(0)

For iRole = 0 To dtCust.Rows.Count - 1
drpCustomer.Items.Add(dtCust.Rows(iRole)("RepofCustomer"))
Next
Else
MsgBox("Please Select any Role !!!", MsgBoxStyle.Information)
End If

con.Close()
End With
End Function





Responses

Author: PRAVEEN PANDEY    29 Nov 2008Member Level: SilverRating:     Points: 4

Hi Komathi,

i don't have idea about Ajax but if you want to bind Dropdown list you
can bind like this.

first create or open your connection.
after that take data from database in reader.
after this you have to write like .

DropdownList.DataSource =dr;
DropdownList.DataTextField="ColumnName";
DropdownList.DataValueField="ColumnName";
DropdownList.Databind();


Regards,
Praveen



Post Reply

 This thread is locked for new responses. Please post your comments and questions as a separate thread.
If required, refer to the URL of this page in your new post.


Next : I can not understand below item template in data grid.Can i use it in grid view?
Previous : What is onclick and onclintclick property in datagrid?In gridview what is that?
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use