Wrox Programmer Forums
Go Back   Wrox Programmer Forums > .NET > Other .NET > General .NET
|
General .NET For general discussion of MICROSOFT .NET topics that don't fall within any of the other .NET forum subcategories or .NET language forums.  If your question is specific to a language (C# or Visual Basic) or type of application (Windows Forms or ASP.Net) try an applicable forum category. ** PLEASE BE SPECIFIC WITH YOUR QUESTION ** When posting here, provide details regarding the Microsoft .NET language you are using and/or what type of application (Windows/Web Forms, etc) you are working in, if applicable to the question. This will help others answer the question without having to ask.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the General .NET section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 9th, 2004, 07:33 PM
Authorized User
 
Join Date: Aug 2004
Posts: 38
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to macupryk Send a message via Yahoo to macupryk
Default How do I setup a dropdownlist for (*Type*) in edit

How do I setup a dropdownlist for (***Type***) in editmode.
Any starters. Any sites.I would appreciate any help.

How do you create and Impliment a new intance or edit an instance
in a datalist?


<ItemTemplate>
<table width="400" style="font: 10pt verdana">
<tr>
<td>
<tr><td>***Type:****</td>
This dropdownlist works in browse <td><asp:DropDownList
AutoPostBack="True" id="ddlCOMMANDTYPE" DataSource='<%# BindTBCOMMANDTYPE() %>'
mode. selectedindex='<%#
GetSelectedIndexCOMMANDTYPE(DataBinder.Eval(Contai ner.DataItem, "CT_REF").ToString())%>' runat="server"
DataTextField="CT_DESCRIPTION"
DataValueField="CT_REF"></asp:DropDownList></td></tr>
<tr><td>Content:</td>
<td><%# Convert.ToString(DataBinder.Eval(Container.DataIte m,
"CM_CONTENT"))%></td></tr>
</td>
</tr>
</table>
<asp:LinkButton id="EditButton" Text="Edit" CommandName="Edit"
runat="server" />
</ItemTemplate>
<EditItemTemplate>
<table width=400 style="font: 10pt verdana">
<tr>
<td>
<tr><td>***Type:****</td>
<tr><td>Content:</td>
<td><asp:TextBox id="CM_CONTENTTextBox" Text='<%#
DataBinder.Eval(Container.DataItem, "CM_CONTENT") %>' runat="server"/></td></tr>
</td>
</tr>
</table>
<asp:LinkButton id="UpdateButton" Text="Update" CommandName="Update"
runat="server" />
<asp:LinkButton id="DeleteButton" Text="Delete" CommandName="Delete"
runat="server" />
<asp:LinkButton id="CancelButton" Text="Cancel" CommandName="Cancel"
runat="server" />
</EditItemTemplate>
</ASP:DataList>
<input type="hidden" id="PageSize" value="1" runat="server"
NAME="PageSize"> <input type="hidden" id="CurrentPage" value="1" runat="server"
NAME="CurrentPage">
<input type="hidden" id="TotalSize" runat="server" NAME="TotalSize">
<asp:LinkButton id="Prev" Text="<< Previous" OnClick="Page_DataList"
runat="server" />
&nbsp;
<asp:LinkButton id="Next" Text="Next >>" OnClick="Page_DataList"
runat="server" />
</form>
////////////////////////////////////////////////////////////////
public int GetSelectedIndexCOMMANDTYPE (string CT_REF)
{
int iLoop;
DataTable dt = ddlDataSet1.Tables["ddlCOMMANDTYPE"];
for (iLoop=0; iLoop < dt.Rows.Count; iLoop++)
{
string srow = dt.Rows[iLoop]["CT_REF"].ToString();

if(srow == CT_REF)
{
return iLoop;
}
};
return 0;

}
//////////////////////////////////////////////////////////////////
public DataSet BindTBCOMMANDTYPE()
{
OdbcConnection myConnection = new
OdbcConnection("DSN=POS;UID=system;PWD=system");

// Populate the ddlDataSet1
myConnection.Open();
const string strSQLDDL = @"SELECT CT_REF, CT_DESCRIPTION FROM
TBCOMMANDTYPE ORDER BY CT_REF";
OdbcDataAdapter myDataAdapter = new OdbcDataAdapter(strSQLDDL,
myConnection);
ddlDataSet1.Clear();
myDataAdapter.Fill(ddlDataSet1, "ddlCOMMANDTYPE");
myDataAdapter.Dispose();
myDataAdapter = null;
myConnection.Close();
return ddlDataSet1;
}
//************************************************** *********************

Any Advice you can give me would be so appreciated.

Thank you Sincerely.
Matt


Knowledge is to be shared.
__________________
Knowledge is to be shared.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Guidelines Item 3: Replace System.Type with Type Ixtlia BOOK: Professional .NET 2.0 Generics 0 August 19th, 2007 04:09 AM
Enable dropdownlist on Edit GS ASP.NET 2.0 Professional 2 March 19th, 2007 12:42 PM
edit dynamic dropdownlist in a datalist jacthemanus ASP.NET 1.0 and 1.1 Professional 1 September 28th, 2006 12:08 PM
Edit "Page Setup" Variables in VBA echovue Access 3 October 27th, 2004 12:56 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.