Это My DetailView1 .. я хочу установить значение для поля подробного просмотра при загрузке страницы в asp.net. поэтому, пожалуйста, пройдите мой код, я надеюсь, что вы можете понять, чего именно я хочу.
<asp:DetailsView ID="DetailsView1" runat="server" AutoGenerateRows="False"
CellPadding="4" DataSourceID="SqlDataSource1" DefaultMode="Insert"
ForeColor="#333333" GridLines="None" Height="50px" Width="125px"
onpageindexchanging="DetailsView1_PageIndexChanging">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<CommandRowStyle BackColor="#D1DDF1" Font-Bold="True" />
<RowStyle BackColor="#EFF3FB" />
<FieldHeaderStyle BackColor="#DEE8F5" Font-Bold="True" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<Fields>
<asp:BoundField DataField="branchid" HeaderText="branchid"
InsertVisible="False" ReadOnly="True" SortExpression="branchid" />
<asp:BoundField DataField="branchcode" HeaderText="branchcode"
SortExpression="branchcode" />
<asp:BoundField DataField="password" HeaderText="password"
SortExpression="password" />
<asp:BoundField DataField="branchname" HeaderText="branchname"
SortExpression="branchname" />
<asp:BoundField DataField="contactperson" HeaderText="contactperson"
SortExpression="contactperson" />
<asp:BoundField DataField="contactnumber" HeaderText="contactnumber"
SortExpression="contactnumber" />
<asp:BoundField DataField="email" HeaderText="email" SortExpression="email" />
<asp:BoundField DataField="address" HeaderText="address"
SortExpression="address" />
<asp:CommandField ShowInsertButton="True" />
</Fields>
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="#2461BF" />
<AlternatingRowStyle BackColor="White" />
</asp:DetailsView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:vhostdom_demoConnectionString1 %>"
InsertCommand="INSERT INTO branch_master(branchcode, password, branchname, contactperson, contactnumber, email, address) VALUES (@branchcode, @password, @branchname, @contactperson, @contactnumber, @email, @address)"
SelectCommand="SELECT branchid, branchcode, password, branchname, contactperson, contactnumber, email, address, status FROM branch_master">
<InsertParameters>
<asp:SessionParameter Name="branchcode" SessionField="branchcode" />
<asp:Parameter Name="password" />
<asp:Parameter Name="branchname" />
<asp:Parameter Name="contactperson" />
<asp:Parameter Name="contactnumber" />
<asp:Parameter Name="email" />
</InsertParameters>
</asp:SqlDataSource>
Мне нужно установить значение в поле кода филиала при загрузке страницы,
как это ...
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
public partial class admin_admin_add_branch : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//This is what exactly i want...Example
DetailView1.control("branchcode").value = "Now i can set value to a boundfield on page load :)";
}
}
Пожалуйста, помогите мне решить эту проблему ... и заранее благодаря вам ...!