Click here to Skip to main content
15,916,941 members
Home / Discussions / C#
   

C#

 
GeneralRe: Download file from server to local folder Pin
Ravi Bhavnani24-Aug-10 5:20
professionalRavi Bhavnani24-Aug-10 5:20 
GeneralRe: Download file from server to local folder Pin
OriginalGriff23-Aug-10 8:20
mveOriginalGriff23-Aug-10 8:20 
GeneralRe: Download file from server to local folder Pin
Luc Pattyn23-Aug-10 7:03
sitebuilderLuc Pattyn23-Aug-10 7:03 
GeneralRe: Download file from server to local folder Pin
OriginalGriff23-Aug-10 8:08
mveOriginalGriff23-Aug-10 8:08 
AnswerRe: Download file from server to local folder Pin
johannesnestler24-Aug-10 4:52
johannesnestler24-Aug-10 4:52 
QuestionUsing Details view Pin
Member 322226423-Aug-10 3:07
Member 322226423-Aug-10 3:07 
AnswerStop cross posting. PinPopular
Pete O'Hanlon23-Aug-10 3:16
mvePete O'Hanlon23-Aug-10 3:16 
QuestionUsing Details View Pin
Member 322226423-Aug-10 2:05
Member 322226423-Aug-10 2:05 
Hi,
i have gridview and have Detail View.

I want to edit the page with all controls loaded instead of showing in Bound Field.

While using <asp:CommandField ShowEditButton="True" />
i am able to show all values in Text boxes.

Instead i need to show in respective controls like textbox,checkboxlist,listbox and drop down.How to implement this?

Any urls or links?

<pre>

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="MenuList.aspx.cs" Inherits="MenuList" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<table>
<tr>
<td valign="top">

<asp:GridView ID="grd_MenuList" runat="server" AutoGenerateColumns="False"
onrowdatabound="grd_MenuList_RowDataBound" DataKeyNames="MenuId"
onselectedindexchanged="grd_MenuList_SelectedIndexChanged">
<Columns>
<asp:BoundField DataField="MenuId" HeaderText="MenuId" Visible="false" />
<asp:BoundField DataField="MenuName" HeaderText="MenuName"
SortExpression="MenuName" />

<asp:hyperlinkfield headertext="URL"
datatextfield="URL"
datanavigateurlfields="URL"
datanavigateurlformatstring="details_title.aspx?titleid={0}" />
<asp:BoundField DataField="Status" HeaderText="Status"
SortExpression="Status" />

<asp:TemplateField HeaderText="Role">
<ItemTemplate >
<asp:Label ID="lbl_Role" runat="server" ></asp:Label>
</ItemTemplate>


</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="Edit">
<ItemTemplate>
<asp:HyperLink ID="hyp_Edit" runat="server" NavigateUrl='<%# Bind("MenuId") %>'

Text="Edit"></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>--%>



<%-- <asp:CommandField HeaderText="Edit" ShowCancelButton="False"
ShowEditButton="True" ShowHeader="True" />--%>
<asp:CommandField ShowSelectButton="True" />

<%-- <asp:HyperLinkField HeaderText="Edit Details..." Text="Edit Details..." DataNavigateUrlFields="MenuId"
DataNavigateUrlFormatString="MenuCreation.aspx?ID={0}" /> --%>

</Columns>
</asp:GridView>
</td>
<td valign="top">
<asp:DetailsView AutoGenerateRows="False" DataKeyNames="MenuId" DataSourceID="SqlDataSource3"
HeaderText="Menu Details" ID="dtv_Menu" runat="server" Width="275px"
onitemupdated="dtv_Menu_ItemUpdated">
<Fields>
<asp:BoundField DataField="MenuName" HeaderText="MenuName"
SortExpression="MenuName" />

<asp:BoundField DataField="URL" HeaderText="URL" SortExpression="URL"/>

<asp:CheckBoxField DataField="ParentMenuId" HeaderText="Is Parent" />

<asp:BoundField DataField="ParentMenuId" HeaderText="ParentMenuId"
SortExpression="ParentMenuId" />
<asp:TemplateField>
<ItemTemplate>

</ItemTemplate>

</asp:TemplateField>
<asp:BoundField DataField="Order" HeaderText="Order" SortExpression="Order" />

<asp:BoundField DataField="RoleName" HeaderText="RoleName"
SortExpression="RoleName" />
<asp:BoundField DataField="Access" HeaderText="Access" SortExpression="Access" />
<asp:BoundField DataField="Status" HeaderText="Status" SortExpression="Status" />
<asp:BoundField DataField="MenuId" HeaderText="MenuId" Visible="False"
ReadOnly="True" SortExpression="MenuId" />

<asp:CommandField ShowEditButton="True" />

<asp:HyperLinkField HeaderText="Edit Details..." Target="_top" Text="Edit Details..." DataNavigateUrlFields="MenuId"
DataNavigateUrlFormatString="MenuCreation.aspx?ID={0}" />


</Fields>
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource3" runat="server" ConnectionString="<%$ ConnectionStrings:AZSSA_TestConnectionString %>"
SelectCommand="SELECT Menu.URL, Menu.ParentMenuId, Menu.MenuName, Menu.[Order], Menu.Status, Roles.RoleName, MenuRole.Access, Menu.MenuId FROM MenuRole INNER JOIN
Menu ON MenuRole.MenuId = Menu.MenuId INNER JOIN
Roles ON MenuRole.RoleId = Roles.RoleID
WHERE (Menu.MenuId = @MenuId)" >
<SelectParameters>
<asp:ControlParameter ControlID="grd_MenuList" Name="MenuId" PropertyName="SelectedValue"
Type="Int16"/>

</SelectParameters>

<%-- <UpdateParameters>
<asp:Parameter Name="au_lname" />
<asp:Parameter Name="au_fname" />
<asp:Parameter Name="phone" />
<asp:Parameter Name="address" />
<asp:Parameter Name="city" />
<asp:Parameter Name="state" Type="String" />
<asp:Parameter Name="zip" Type="String" />
<asp:Parameter Name="contract" />
<asp:Parameter Name="au_id" Type="String" />
</UpdateParameters>--%>
</asp:SqlDataSource>
</td>
</tr>
</table>


</pre>

<code>

using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Examples;
using System.Data;
using System.Data.SqlClient;
using System.Text;
public partial class MenuList : System.Web.UI.Page
{
public string strRoleName="";
protected void Page_Load(object sender, EventArgs e)
{

grd_MenuList.DataSource = SP.GetMenuList();
grd_MenuList.DataBind();
}

protected void grd_MenuList_SelectedIndexChanged(object sender, EventArgs e)
{
dtv_Menu.ChangeMode(DetailsViewMode.ReadOnly);

}
protected void dtv_Menu_ItemUpdated(object sender, DetailsViewUpdatedEventArgs e)
{
grd_MenuList.DataBind();
}

</code>

Thanks
S.Guhananth
Answerrepeat-cross-post alert; failing PRE alert Pin
Luc Pattyn23-Aug-10 2:52
sitebuilderLuc Pattyn23-Aug-10 2:52 
QuestionMessage Removed Pin
23-Aug-10 0:17
Member 322226423-Aug-10 0:17 
AnswerPRE-less cross-post alert Pin
Luc Pattyn23-Aug-10 1:32
sitebuilderLuc Pattyn23-Aug-10 1:32 
QuestionC# Talking To All The ContextMenuStrip's Pin
C.CoderCreator23-Aug-10 0:03
C.CoderCreator23-Aug-10 0:03 
AnswerRe: C# Talking To All The ContextMenuStrip's Pin
Mycroft Holmes23-Aug-10 0:45
professionalMycroft Holmes23-Aug-10 0:45 
AnswerRe: C# Talking To All The ContextMenuStrip's Pin
Rhuros23-Aug-10 1:26
professionalRhuros23-Aug-10 1:26 
GeneralRe: C# Talking To All The ContextMenuStrip's Pin
C.CoderCreator23-Aug-10 22:33
C.CoderCreator23-Aug-10 22:33 
GeneralRe: C# Talking To All The ContextMenuStrip's Pin
Rhuros23-Aug-10 23:16
professionalRhuros23-Aug-10 23:16 
GeneralRe: C# Talking To All The ContextMenuStrip's Pin
C.CoderCreator24-Aug-10 0:05
C.CoderCreator24-Aug-10 0:05 
AnswerRe: C# Talking To All The ContextMenuStrip's [modified] Pin
Rhuros24-Aug-10 0:50
professionalRhuros24-Aug-10 0:50 
GeneralRe: C# Talking To All The ContextMenuStrip's Pin
C.CoderCreator24-Aug-10 0:55
C.CoderCreator24-Aug-10 0:55 
GeneralRe: C# Talking To All The ContextMenuStrip's Pin
Rhuros24-Aug-10 1:07
professionalRhuros24-Aug-10 1:07 
GeneralRe: C# Talking To All The ContextMenuStrip's Pin
C.CoderCreator24-Aug-10 1:11
C.CoderCreator24-Aug-10 1:11 
AnswerRe: C# Talking To All The ContextMenuStrip's [modified] Pin
Rhuros24-Aug-10 1:24
professionalRhuros24-Aug-10 1:24 
GeneralRe: C# Talking To All The ContextMenuStrip's Pin
C.CoderCreator24-Aug-10 22:05
C.CoderCreator24-Aug-10 22:05 
GeneralRe: C# Talking To All The ContextMenuStrip's Pin
Rhuros25-Aug-10 1:08
professionalRhuros25-Aug-10 1:08 
GeneralRe: C# Talking To All The ContextMenuStrip's Pin
C.CoderCreator25-Aug-10 19:55
C.CoderCreator25-Aug-10 19:55 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.