Click here to Skip to main content
14,875,030 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi, I need help. After login user need to select their name. after he/she select their name, automatically their employee number and department appear in space provided. I already code it. But in employee number and department space appear the user name. please anyone help me. Thank you. Below is my code:

'Requestor_Name
DataSource1.SelectCommand = "SELECT * FROM CUST_TB_Requestor"
DV = DataSource1.Select(DataSourceSelectArguments.Empty)
For Each R In DV
req_name.Items.Add(New ListItem() With {.Text = R(0)})
Next
DV.Dispose()



req_emNo.Text = req_name.SelectedValue.Split("-")(1)
reqDept.Text = req_name.SelectedValue.Split("-")(2)
Posted
Updated 1-Dec-15 13:27pm
v2
Comments
Richard MacCutchan 26-Nov-15 3:25am
   
Use your debugger to find the values resulting from the call to req_name.SelectedValue.Split
Member 12077709 26-Nov-15 3:32am
   
Try ready. Its Show an Error.
Richard MacCutchan 26-Nov-15 4:40am
   
What error? If you want help with your problem(s) then please make an effort to provide all relevant details.
John C Rayan 26-Nov-15 5:00am
   
Need more details.
Member 12077709 26-Nov-15 19:40pm
   
I'm writing an approval system. The requester send request application form to manager for approve. after the manager approve the request form, Security also need to approve the request. The user login into the system. After he/she login into the system directly going to homepage. In homepage have 3 characters. They are REQUESTER, MANAGER, and SECURITY. The user need to choose which category there are. If he/she is a requester, then they need to click the requester image. After click the requester image, directly going to request form. In request form they no need key in their detail. the details automatically fill the textboxes.
Member 12077709 26-Nov-15 19:42pm
   
the details are in oracle sql developer. above is the code i try to do it to solve the problem. but i can't. Please help me to improve my code or give some suggestion to improve my code. THank you
John C Rayan 27-Nov-15 2:05am
   
Can you post your entire code where you get the error
Member 12077709 27-Nov-15 2:32am
   
'Requestor_Name
DataSource1.SelectCommand = "SELECT * FROM CUST_TB_Requestor"
DV = DataSource1.Select(DataSourceSelectArguments.Empty)
For Each R In DV
req_name.Items.Add(New ListItem() With {.Text = R(0)})
Next
DV.Dispose()


req_emNo.Text = req_name.SelectedValue.Split("|")(1)
reqDept.Text = req_name.SelectedValue.Split("|")(0)
Member 12077709 27-Nov-15 2:43am
   
Actually I'm not getting error. After login the need to select their name from dropdownlist. After select their name, automatically their employee number and department fill the textboxes. But, in the textbox fill up the user name. that's my problem
John C Rayan 27-Nov-15 4:39am
   
Tow things here you have to let me know.

1. Where do you assign Value to req_name dropdown. I could see only Text.
2. Debug your code and let me know what is the value you get for req_name.SelectedValue.
Member 12077709 29-Nov-15 19:22pm
   
if I debug my code, I got answers the names of those in the database. but the first name. For example, the first name in the database is John, then in the employee number and department textbox also shows the name john. if i select the second name means, employee number and department textboxt haven't any changes.
Member 12077709 29-Nov-15 19:49pm
   
'Requestor_Name
DataSource1.SelectCommand = "SELECT * FROM CUST_TB_Requestor"

this code for req_name dropdown.

I am not sure whether the code is correct or not. Please help me. Thank You.
John C Rayan 30-Nov-15 4:29am
   
Post your code here. I'll have a look. I don't think you getting the right values in your dropdown list. You have to set the values of the dropdown list to the expected values.

This line is the problematic.

req_name.Items.Add(New ListItem() With {.Text = R(0)})

Can you show us the table structure and values too.
Member 12077709 30-Nov-15 20:09pm
   
If IsPostBack = False Then


'declare DV as dataview object
Dim DV As Data.DataView

'execute the select query and store the result in DV
DV = DataSource1.Select(DataSourceSelectArguments.Empty)


'Requestor_Name
DataSource1.SelectCommand = "SELECT * FROM CUST_TB_Requestor"
DV = DataSource1.Select(DataSourceSelectArguments.Empty)
For Each R In DV
req_name.Items.Add(New ListItem() With {.Text = R(0)})
Next
DV.Dispose()

End If

req_emNo.Text = req_name.SelectedValue.Split("-")(0)




'A.Requestor

req_name.Text = req_name.SelectedItem.Text
req_emNo.Text = req_emNo.Text
reqDept.Text = reqDept.Text
reqDate.Text = reqDate.Text
Purpose.Text = Purpose.SelectedItem.Text
rturn.Text = rturn.SelectedItem.Text
AppMgr.Text = AppMgr.SelectedItem.Text
Member 12077709 30-Nov-15 20:16pm
   
the details are into the oracle sqldeveloper. If i debug and select user name automatically fill the textbox for employee number and department. I really do know where i did the mistake. Above is the full code requester. Please help

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900