Wednesday, January 9, 2013

Disable dropdown list using radio button in asp.net using c#.net

In previous post we have seen how to disable the drop down list using other dropdown list.In the below we will use radio button to disable the drop down list in asp.net using c#.net.For this we have to use radiobutton checked change event
Code behind:
protected void rbcheck_CheckedChanged(object sender, EventArgs e)
{
ddltest.Enabled = false;
}

Aspx:
 <asp:RadioButton ID="rbcheck" runat="server"
 oncheckedchanged="rbcheck_CheckedChanged"  AutoPostBack="true"/>
<asp:DropDownList ID="ddltest" runat="server"
 AutoPostBack="True">
<asp:ListItem>Please select</asp:ListItem>
</asp:DropDownList>

Tuesday, January 8, 2013

Disable/enable Dropdownlist in asp.net using c#.net

In this post i will show how to disable a drop down in asp.net using c#.net.Here i have used two drop down lists to perform this task. Whenever  the first drop down  selected then another drop down will be disabled
Aspx:
<asp:DropDownList ID="ddloption" runat="server" onselectedindexchanged="ddloption_SelectedIndexChanged" 
       AutoPostBack="True">
<asp:ListItem>Please select</asp:ListItem>
<asp:ListItem>Hyderabad</asp:ListItem>
</asp:DropDownList>
<asp:DropDownList ID="ddlcode" runat="server" 
AutoPostBack="True">
<asp:ListItem>Please select</asp:ListItem>
</asp:DropDownList>
Code :
protected void ddloption_SelectedIndexChanged(object sender, EventArgs e)
{
ddlcode.Enabled = false;
}
The above code is for drop down selected index event for first drop down list

Monday, January 7, 2013

Get the dropdown selectedIndex in asp.net using c#.net

In previous post we have seen how to get the drop down selected value.In this post i will show how to get the selected index value in asp.int using c#.net.Here i have used one drop down list and label to display index value.

Code:
protected void dtest_SelectedIndexChanged(object sender, EventArgs e)
{
 lbly.Text = dtest.SelectedIndex.ToString();
}
aspx:
<asp:DropDownList ID="dtest" runat="server" onselectedindexchanged="dtest_SelectedIndexChanged"
       AutoPostBack="True">
<asp:ListItem>Please select</asp:ListItem>
<asp:ListItem>Hyderabad</asp:ListItem>
<asp:ListItem>Chennai</asp:ListItem>
<asp:ListItem>Bombay</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lbly" runat="server" Text="Label"></asp:Label>


Get the dropdown selected value in asp.net using c#.net

Title:
How to get the drop down list selected value in asp.net using c#

Description:
The drop down list will display the list of items and each list of item is selectable.The best thing  of this control is ,we can bind static data or dynamic data which is to be done by using data binding concept.Now we know this control can support data binding

Example:
Some recent posts on drop down list selected value ,Jquery Drop down list validation .Now i would like to give an example on  how to get the drop down selected value in asp.net using c#.Before going to start ,we have to add one drop down list with label control which will be used to  display the drop down selected value .
Note:One more thing we need to remember i:e auto post back property set to true.If you want to see the properties of web control ,focus on control and click on F4

Aspx page:
<asp:DropDownList class="HTML" id="ddlcitytest" name="code" onselectedindexchanged="ddlcitytest_SelectedIndexChanged" runat="server"AutoPostBack="True">
<asp:ListItem>Please select</asp:ListItem>
<asp:ListItem>Hyderabad</asp:ListItem>
<asp:ListItem>Chennai</asp:ListItem>
<asp:ListItem>Bombay</asp:ListItem>
<asp:ListItem>Delhi</asp:ListItem>
</asp:DropDownList>
<asp:Label ID="lblcity" runat="server" Text="Label"></asp:Label>

codebehind:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class About : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void ddlcitytest_SelectedIndexChanged(object sender, EventArgs e)
{
//Get the selected value
lblcity.Text = ddlcitytest.SelectedValue.ToString();
}
}
In the above code the selected value has been assigned to label for display purpose.


Thursday, January 3, 2013

How to disassemble the dll in .net

It will need when we have to change any modifications to precomplied dll.There is no straight way to make changes to dll.For this i have used to ".net Reflector" which has to be downloaded then check which class file has to be changed.
DLL into sourcecode
Finally make change in source code files and create compiled DLL

Wednesday, January 2, 2013

How set default page in iis for Asp.net application


There are two ways to be set default page for application.One way is adding the default document to configuration file(web.config).Other way is directly set the default document in IIS
<system.webServer>
    <defaultDocument>
        <files>
            <add value="~/OrdsrHome.aspx"/>
        </files>
    </defaultDocument>
</system.webServer>
Configure in IIS :
Click on application -->go to Features view then do the below process as per screen shots



The default Page has been set to application as you can see in the above image
 

Bel