I am very new to C# and aspx files. we are using very old application written in 2008 and don't have any contact details of developer. what we want to do is to make some changes as some parts of original code is not relevant any more. I've managed to locate .aspx file and did some changes but some of them are not working. was trying to locate .aspx.cs file but it looks like they all were compiled in .dll file in bin folder. I did find the original .aspx.cs file in back up.
The problem I have is that one of the fields in the form is dropdown list and is linked to data table in sql and is set up as required. When I open web page, the default value in this dropdown list is -Select Contact Method-.
My understanding this is because the code behind has the following:
# region populate ContactMethod Combo(Primary and Secondary)**
private void PopulateContactMethod(int intContactMethodID)
{
// get data
MasterValue oMV = new MasterValue();
DataTable dt = oMV.GetAll(MasterValueType.ContactMethod);
// populate combo
oUtil.PopulateCombo(cboContact, dt, "intID", "strText",
intContactMethodID.ToString(), "-Select Contact Method-");
}
# endregion
The SQL table has the following values 1=Home Phone, 2= Mobile, 3=Email & 4 =None
And the .aspx file has the following:
<%@ Page CodeBehind="add_new_user.aspx.cs" Language="c#" AutoEventWireup="false"
Inherits="App.UI.add_new_user" %>
.
.
.
<tr>
<td class="formtext" align="right">Primary Contact Method:<SPAN class="star">*</SPAN>
</td>
<td class="formtext" vAlign="top" align="left">
<asp:dropdownlist id="cboContact" runat="server" CssClass="ListBox" Width="150px">
</asp:dropdownlist>
<asp:requiredfieldvalidator id="rfvContactMethod" runat="server"
ControlToValidate="cboContact" Display="None" ErrorMessage="Please select contact
method" InitialValue="0">
</asp:requiredfieldvalidator>
</td>
</tr>
What we need is when we open web page default value in this dropdown list is None (4) and not -Select Contact Method-.
Any help will be much appreciated!
Thank you in advance.