<br />
<strong>MultiView<br />
<asp:RadioButtonList ID="RadioButtonList1" runat="server" AutoPostBack="True" RepeatDirection="Horizontal" OnSelectedIndexChanged="RadioButtonList1_SelectedIndexChanged">
<asp:ListItem Value="0">Bulleted List</asp:ListItem>
<asp:ListItem Value="1">File Upload</asp:ListItem>
<asp:ListItem Value="2">URL Mapping</asp:ListItem>
</asp:RadioButtonList><br />
<br />
</strong>
<br />
<asp:MultiView ID="MultiView1" runat="server">
<asp:View ID="View1" runat="server">
Bulleted List Control<br />
<br />
<asp:BulletedList ID="BulletedList1" runat="server" DataSourceID="XmlDataSource1"
DataTextField="text" DataValueField="url" DisplayMode="HyperLink">
<asp:ListItem Value="http://www.microsoft.com">Microsoft</asp:ListItem>
</asp:BulletedList>
<asp:XmlDataSource ID="XmlDataSource1" runat="server" DataFile="~/hyperlinks.xml"></asp:XmlDataSource>
</asp:View>
<asp:View ID="View2" runat="server">
File Upload Control<br />
<br />
<asp:FileUpload ID="FileUpload1" runat="server" /><br />
<asp:Button ID="Button1" runat="server" Text="Upload" OnClick="Button1_Click" /><br />
<asp:HyperLink ID="HyperLink1" runat="server">HyperLink</asp:HyperLink></asp:View>
<asp:View ID="View3" runat="server">
URL mapping<br />
<br />
<a href="guid_{492f3e0b-848e-11da-9550-00e08161165f}.htm">guid_{492f3e0b-848e-11da-9550-00e08161165f}.htm</a><br />
<br />
<a href="guid.htm">guid.htm</a>
<br />
</asp:View>
</asp:MultiView>
</form>
//cODE
protected void Button1_Click(object sender, EventArgs e)
{
if (FileUpload1.HasFile)
{
FileUpload1.SaveAs(("c:\\websites\\tricks\\upload\\" + FileUpload1.FileName));
HyperLink1.Text = FileUpload1.FileName;
HyperLink1.NavigateUrl = ("upload\\" + FileUpload1.FileName);
}
}
protected void RadioButtonList1_SelectedIndexChanged(object sender, EventArgs e)
{
MultiView1.ActiveViewIndex = Convert.ToInt32(RadioButtonList1.SelectedValue);
}
Source ASP.NET Videos
No comments:
Post a Comment