473,406 Members | 2,867 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

Problem with DetailsView control of asp.net

8
Hello ,

I am trying to add a user control in detals view for its insert mode.My user control

consists of dropdown list . The dropdown is being displayed in detailsview's insert

mode but its blank.

My code is as shown below ,

************************************************** *************************************

***************************



<%@ Page Language="VB" Debug="true"%>
<%@ Import Namespace="System" %>
<%@ Import Namespace=" System.Reflection"%>
<%@ Import Namespace=" System.Web.UI"%>
<%@ Import Namespace=" System.Web.UI.WebControls"%>
<%@ Import Namespace="system.dbnull"%>
<script runat="server">

Sub page_load()
If Not Page.IsPostBack Then

End If
End Sub


Sub pp(ByVal sender As Object, ByVal e As System.EventArgs)


If DetailsView1.CurrentMode = DetailsViewMode.Insert Then


Dim myUC1 As UserControl
myUC1 = LoadControl("dtry.ascx")
Dim ucType As Type = myUC1.GetType()

Dim checkboxProperty As PropertyInfo = ucType.GetProperty("tablenm")
checkboxProperty.SetValue(myUC1, "state", Nothing)

checkboxProperty = ucType.GetProperty("fieldnm")
checkboxProperty.SetValue(myUC1, "snm", Nothing)


DetailsView1.Rows(0).Cells(1).Controls.Clear()

DetailsView1.Rows(0).Cells(1).Controls.Add(myUC1)
End If
End Sub

</script>

<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:DetailsView ID="DetailsView1" OnDataBound="pp" DataSourceID="s1"

runat="server" Height="50px" Width="125px">
<Fields>
<asp:CommandField ShowDeleteButton="True" ShowEditButton="True"

ShowInsertButton="True" />
</Fields>
</asp:DetailsView>
&nbsp;

<asp:SqlDataSource ID="s1" SelectCommand="select * from city"

ConnectionString="<%$ ConnectionStrings:svitConnectionString7 %>"

runat="server"></asp:SqlDataSource>
</div>
</form>
</body>
</html>



************************************************** *************************************

***********

Please help me if possible.



Thanks ........
Mar 22 '07 #1
0 731

Sign in to post your reply or Sign up for a free account.

Similar topics

1
by: Shawn Wildermuth | last post by:
I have a *single* SqlDataSource that loads up a single result set that I show in a GridView. In the GridView, i've added a "Select" button and handling the SelectedItem event. I also have a...
2
by: Andrew Robinson | last post by:
Is there any way to accomplish two way data binding in a Details View with a DataSet or DataTable as the DataSource. All I want is to get an updated DataSet or DataTable back from the...
12
by: Jim Hammond | last post by:
I am passing the whole object instead or parameters in my select and update methods. I can get the updated object if I set UpdateMethod, let ASP.NET autogenerate an update button, and then press...
1
by: sck10 | last post by:
Hello, I am trying to change a value when a user goes into edit mode on a DetailsView control. I am trying to use the following, but can not figure out how to get to the bound field...
5
by: sck10 | last post by:
Hello, I am using the code below to set the values of a DetailsView template field using FindControl. My question is how would you find a control if its a Boundfield control? For example,...
2
by: Ram | last post by:
I'm using detailsview control with a template field which contains a dropdownlist I databind the dropdownlist during page load, now the problem is dropdownlist loses state during postbacks, i...
2
by: clickon | last post by:
I am using ASP.net 2.0 and trying to take advantage of the updated data editing facilities provided through the SQLDataSource control and the DetailsView control. The data is a record from a...
0
by: Seok Bee | last post by:
Dear Experts, In my web application, I have a Master/Detail display of records using Gridview and DetailsView controls. Whenever, I made a selection of a record from the Gridview control, the...
2
by: Jarod | last post by:
Hey I change backColor of linkButton in my Page_Load: lbDoSth.BackColor = Color.Red; But I have multiView on this page. On one of the views I have detailsView. When I add a new row a set...
5
by: =?Utf-8?B?bXBhaW5l?= | last post by:
Hello, I am completely lost as to why I can't update a DropDownList inside a DetailsView after I perform an insert into an object datasource. I tried to simply it down to the core demostration:...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.