Click here to Skip to main content
15,886,788 members
Home / Discussions / ASP.NET
   

ASP.NET

 
Questionhow to change language in web application Pin
Rama krishna.M1-Apr-07 20:50
Rama krishna.M1-Apr-07 20:50 
Questioncreating a table Pin
Oga M1-Apr-07 20:31
Oga M1-Apr-07 20:31 
AnswerRe: creating a table Pin
Sathesh Sakthivel1-Apr-07 20:39
Sathesh Sakthivel1-Apr-07 20:39 
Questionneed help with select image button Pin
neodeaths1-Apr-07 20:14
neodeaths1-Apr-07 20:14 
AnswerRe: need help with select image button Pin
Deepak the Cool1-Apr-07 21:00
Deepak the Cool1-Apr-07 21:00 
GeneralRe: need help with select image button Pin
neodeaths1-Apr-07 21:49
neodeaths1-Apr-07 21:49 
QuestionSub Report in crystal report (ASP.NET 2.0) Pin
varshavmane1-Apr-07 20:13
varshavmane1-Apr-07 20:13 
QuestionIs it possible to select multiple items from a listbox and insert into a database? Pin
irkahc1-Apr-07 19:53
irkahc1-Apr-07 19:53 
Hi am using DetailsView and ObjectDataSource to insert records in database.
detailsview contains dropdown,texbox and Listbox controls.. I selected multiple items from Listbox and now if I click on Insert button multiple records has to be inserted in database. Is this possible...? can u send me the code how can I approach? pls see the following code..
while trying to put code for listbox it is inserting last record only...
// Code behind file
protected void DVDoctorActivity_ItemInserting(object sender, DetailsViewInsertEventArgs e)
{

if (Page.IsValid)
{
string strDoctor = ((DropDownList)((DetailsView)sender).FindControl("ddlInsDoctor")).SelectedValue;
e.Values["DoctorId"] = strDoctor;
e.Cancel = false;
}
foreach (ListItem listitem in ((ListBox)((DetailsView)sender).FindControl("lbProducts")).Items) // it is inserting only one record.. (last selected item)
{
if (listitem.Selected)
{
string strProductId = ((DropDownList)((DetailsView)sender).FindControl("ddlInsDoctor")).SelectedValue;
e.Values["ProductId"] = Convert.ToInt32(strDoctorId);
}

else e.Cancel = true;
}


// aspx file..
<asp:DetailsView ID="DetailsView1" runat="server" SkinID="DetailsView" DataKeyNames="DoctorActivityId"
DataSourceID="DoctorActivityDataSource" AutoGenerateRows="False" OnItemInserting="DVDoctorActivity_ItemInserting">
<Fields>
<asp:TemplateField>
<InsertItemTemplate>
<asp:Panel ID="Panel1" runat="server" Height="50px" Width="125px">
<table>
<tr>
<td style="width: 113px; height: 21px;">
Doctor&nbsp;</td>
<td style="height: 21px">
<asp:DropDownList ID="ddlInsDoctor" runat="server" DataSourceID="DVDoctorMasterDataSource"
DataTextField="DoctorName" DataValueField="DoctorId">
</asp:DropDownList><asp:ObjectDataSource ID="DVDoctorMasterDataSource" runat="server"
OldValuesParameterFormatString="original_{0}" SelectMethod="GetAllDoctors" TypeName="ActNexxt.ActNexxtDataSetTableAdapters.Doctor_MasterTableAdapter">
</asp:ObjectDataSource>
&nbsp;</td>
</tr>
<tr>
<td style="width: 113px">
</td>
<td>
<asp:TextBox ID="txtEdtEmpId" Visible="false" runat="server" Text='<%# Bind("EmployeeId") %>'></asp:TextBox>&nbsp;</td>
</tr>
<tr>
<td>
<asp:ListBox ID="lbProducts" runat="server"></asp:ListBox>
<asp:ObjectDataSource ID="CampaignDrugSource" runat="server"
InsertMethod="Insert" OldValuesParameterFormatString="original_{0}" SelectMethod="GetProductsByCampaignId"
TypeName="ActNexxt.ActNexxtDataSetTableAdapters.Campaign_DrugTableAdapter" >
>/td>
</tr>
</table>
</asp:Panel>
</InsertItemTemplate>
</asp:TemplateField>

<asp:TemplateField ShowHeader="False">
<EditItemTemplate>
<asp:Button ID="Button1" runat="server" CommandName="Update" Text="Update" SkinID="Button" />
<asp:Button ID="Button2" runat="server" CommandName="Cancel" Text="Cancel" SkinID="Button"
CausesValidation="false" />
</EditItemTemplate>
<InsertItemTemplate>
<asp:Button ID="Button1" runat="server" CommandName="Insert" Text="Insert" SkinID="Button" />
<asp:Button ID="Button2" runat="server" CommandName="Cancel" Text="Cancel" SkinID="Button"
CausesValidation="false" />
</InsertItemTemplate>
<ItemTemplate>
<asp:Button ID="Button1" runat="server" CommandName="New" Text="New" SkinID="Button" />
<asp:Button ID="Button2" runat="server" CommandName="Edit" Text="Edit" SkinID="Button" />
</ItemTemplate>
<ItemStyle HorizontalAlign="Center" />
</asp:TemplateField>
</Fields>
</asp:DetailsView>

thanks..
QuestionBooks Pin
aaraaayen1-Apr-07 19:29
aaraaayen1-Apr-07 19:29 
AnswerRe: Books Pin
Sathesh Sakthivel1-Apr-07 20:03
Sathesh Sakthivel1-Apr-07 20:03 
Questionhow to separate the sessions?? or have two form authenfitication?? [modified] Pin
bigeyed1-Apr-07 15:32
bigeyed1-Apr-07 15:32 
QuestionCss doesn't apply to my pages. Pin
rockxuyenmandem1-Apr-07 13:54
rockxuyenmandem1-Apr-07 13:54 
QuestionASP.NET load/stress testing Pin
econner1-Apr-07 8:31
econner1-Apr-07 8:31 
QuestionNew Row Pin
hadad1-Apr-07 8:01
hadad1-Apr-07 8:01 
AnswerRe: New Row Pin
Venkatesh Mookkan1-Apr-07 19:35
Venkatesh Mookkan1-Apr-07 19:35 
QuestionError Saving data into database Pin
suriee1-Apr-07 4:31
suriee1-Apr-07 4:31 
AnswerRe: Error Saving data into database Pin
kubben1-Apr-07 9:56
kubben1-Apr-07 9:56 
QuestionSelect Increment Field Pin
Moooooodi1-Apr-07 3:26
Moooooodi1-Apr-07 3:26 
AnswerRe: Select Increment Field Pin
Hesham Amin1-Apr-07 6:48
Hesham Amin1-Apr-07 6:48 
AnswerRe: Select Increment Field Pin
Venkatesh Mookkan1-Apr-07 18:33
Venkatesh Mookkan1-Apr-07 18:33 
QuestionProblem in handling events of Usercontrol Pin
aeku31-Mar-07 23:48
aeku31-Mar-07 23:48 
AnswerRe: Problem in handling events of Usercontrol Pin
kubben1-Apr-07 2:25
kubben1-Apr-07 2:25 
QuestionObject Size in Memory - Is this possible? Pin
matthias s.31-Mar-07 23:46
matthias s.31-Mar-07 23:46 
QuestionFormView FindControl Problem - Can someone help, please? Pin
JackChase31-Mar-07 21:52
JackChase31-Mar-07 21:52 
Questiondropdownlist problem Pin
Kunal P31-Mar-07 21:00
Kunal P31-Mar-07 21:00 

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.