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>
<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 ........