.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

DataList and DetailsView problem

Posted By:      Posted Date: August 31, 2010    Points: 0   Category :ASP.Net
I have a problem hooking up the datalist to the details view. I know everything server side is fine cause the default values work, but I guess I am not getting post back from the datalist. Here is my code.<div id="thumbnail">                     <asp:DataList ID="DataList1" runat="server" DataSourceID="ObjectDataSource2"                          RepeatDirection="Horizontal" DataKeyField="ItemsID">                         <ItemTemplate>                             <asp:ImageButton ID="Image1" runat="server" ImageUrl='<%# "Handler.ashx?ItemsID=" + Eval("ItemsID")%>'/>                             <asp:Button ID="button1" runat="server" Text='<%# Eval("ItemsID") %>' />                         </ItemTemplate>                     </asp:Dat

View Complete Post

More Related Resource Links

datalist image slide show problem


hi friends

i am binding  images dynamically(back end)for a datalist .iam applying a slideshow for it .I am getting a problem to apply slideshow for dyanmically binded images.If the define in a div statically it working perfectly

for example pls go through my code below:

<script type="text/javascript">
$(document).ready(function() {
        fx: 'scrollLeft' // choose your transition type, ex: fade, scrollUp, shuffle, etc...

<div class="slideshow">
        <img src="images/30_dummy.jpg" width="200" height="200" />
        <img src="images/aquarius.gif" width="200" height="200" />
        <img src="images/star.gif" width="200" height="200" />
        <img src="images/the-proud-indian-flag-1.jpg" width="200" height="200" />

I above code works perfectly and the slide show e

Weird problem in Detailsview - Dropdownlist in



I'm new in this forum and I really hope you'll be able to help me.

I converted a field in the detailsview into a template field and put a dropdownlist in the <InsertItemTemplate> and it worked great. This is the code I put:

<InsertItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre"  DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></InsertItemTemplate>

Now, I tried to do the same thing for the <EditItemTemplate> . This is the code I put there:

<EditItemTemplate><asp:DropDownList runat="server" DataSourceID="sdsGenresPossible" DataTextField="Genre" DataValueField="Index" SelectedValue='<%# Bind("Genre") %>' ></asp:DropDownList></EditItemTemplate>  

When I change the DV properties I do see that a dropdownlist was  added but when I run the program and click on "Edit" in the DV nothing happens (however when I click on "Insert" it works fine).

This is the Select command for the data source I used:

<asp:SqlDataSource runat="server"

datalist printOut() function Problem

  • i m using below code..by using it i able to write asp data into word file n format it.but i m facing problen in print out..

    it show exception

    Message = "The object invoked has disconnected from its clients. (Exception from HRESULT: 0x80010108 (RPC_E_DISCONNECTED))"

    please hav a look at below code....

  •  .................div data...................   
  •   <div id="printdiv" runat="server">   
  •     <table style="border: 5px solid #FF00FF; width:100%">   
  •     <tr>   

  • DetailsView edit problem after changing database

    Hello!I had a DetailsView control for editing records in a Access 2003 database. I transfered the database to MS SQL 2008 and using the same code does not work - after clicking edit nothing happens (no error) and the record is not updated.ASP code:<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent"> <h2> Urejanje kontaktnih podatkov </h2> <p> <asp:TextBox ID="txtKontaktID" Visible="false" runat="server"></asp:TextBox> <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:conKrik %>" ProviderName="<%$ ConnectionStrings:conKrik.ProviderName %>"  SelectCommand="SELECT tblKontakt.*, tblStranka.strSkrajsanNaziv FROM krik.tblKontakt INNER JOIN krik.tblStranka ON tblKontakt.StrankaID = tblStranka.StrankaID WHERE ([KontaktId] = @id)" UpdateCommand="UPDATE tblKontakt SET strIme = @strIme, strPriimek = @strPriimek, strPoslovnaEnota = @strPoslovnaEnota, strTelefon = @strTelefon, strFaks = @strFaks, strMobitel = @strMobitel, strEmail = @strEmail, rmkOpomba = @rmkO

    Problem binding data to DropDownList in DetailsView

    Hi guys. I have a slight issue I awas trying to fix for 2-3 days, but nothing I try works. The scenario: DetailsView control in edit mode, I pass parameters to the SqlDataSourceProducts (edit.aspx?id=2) and the data source selects the appropriate data and fills in the DetailsView form. Except two drop down lists. These two DDLs (DDL2 and DDL3) are dependent on the previous DDL (DDL1) in the DetailsView. Thanks to PeteNet, when the selected value of the DDL1 changes, DDL2 and 3 change their lists and get bound to the database. The problem is: when I edit something from the database, DDL2 and 3 appear empty and when I update any other field and leave these, they get blanked in the database.  My goal is to set the selected value of DDL2 and 3 to the values in the database WHERE ID = QueryStringField="id". I can go for not binding the data unless the field is changed, but does not sound professional and user friendly. code: The SqlDataSource used to select the parameters from the table and populate the DetailsView <asp:SqlDataSource ID="SqlDataSourceProduct" runat="server" ConnectionString="<%$ ConnectionStrings:ConnectionString %>" SelectCommand="SELECT ID, wm_number, upc, check_digit, unit, price_unit, brand, category, shelves, type, cooking, storage, packaging, origin, nutriti

    Problem with datalist paging


    I having a little problem to get the paging for my datalits to work. I have used this article: http://aspalliance.com/157 which i found do the things i wanted. I have implemented the code but no records show at all.. No errors.. Can anybody see what i have done wrong? Thank you!

    Here is my aspx code:

    <h2 align="center"><font face="verdana">Paging in DataList</font></h2>
    <a name="this"></a>
    <asp:DataList ID="dList" Runat="server" Width="100%"
    <table width="100%" style="font: 10pt verdana" cellpadding=0 cellspacing=0>
    <tr style="background-color:FF0000">
    <th align=left><font color="#FFFFFF">Store ID</font></th>
    <th align=left><font color="#FFFFFF">Order Number</font></th>
    <tr style="background-color:#f5f5dc">
    <td><%#DataBinder.Eval(Container.DataItem, "pName")%></td>

    problem with datalist in updatepanel


    Hi! i try to make a search part. there is a textbox which will be used for search context. also, i need to list category names. i don't use dropdownlist because its styles(for example border-style)doesn't change. So i tyr to do like this:i use a label and datalist. when clicking the label, datalist is showing. when i click the category name on datalist, it will be shown on label.(label is not in datalist.)my problem starts at that point. when i click category name on datalist , page is being postback. so i put datalist into updatepanel. but this time , i click category name on datlist,nothing occurs.(category name doesn't shown on label).my code is below:

    <asp:UpdatePanel ID="UpdatePanel1" runat="server">

    Star rating in Datalist problem


    I have a user comments area that people can add their comments to the page.  I have successfully gotten the star rating to save into the database.  I now want to display the star rating into a datalist.

    Here is what I have so far:

    <asp:DataList ID="DataList1" runat="server" CellPadding="3"
                    DataSourceID="dsHotelComments" Visible="False" BackColor="White"
            BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"
        GridLines="Horizontal" Width="843px">
                    <FooterStyle BackColor="#B5C7DE" ForeColor="#4A3C8C" />
                    <AlternatingItemStyle BackColor="#F7F7F7" />
                    <ItemStyle BackColor="#E7E7FF" ForeColor="#4A3C8C" />
                    <SelectedItemStyle BackCo

    Problem with Editing image inside DetailsView inside UpdatePanel



    I have a problem and I really hope you'll be able to help me.

    I'm trying to add and edit an image which is located in a detailsview which is inside an UpdatePanel. After I read relevant topics in the forum I installed the Ajax Control Toolkit. Below is my source code. When I used it only for insert new image it worked great. The problem caused when I tried to implement it on the Edit mode, i.e. when I tried to edit the image and upload a different image.  Unfortunately it didn't work as I hoped. Nothing happend and the image hasn't been changed. I also tried to change the IDs (AsyncFileUpload ID) to be the same in both places but it didn't work either.

    The source code:

    <asp:DetailsView ID="dvMovie" runat="server" Height="50px" Width="695px"
                        AutoGenerateRows="False" DataSourceID="sdsMovieById"      
                         BorderColor="#E7E7FF" BorderStyle="None" BorderWidth="1px"

    Problem filling labels with table data outside datalist using single call to db


    On a single page, I'd like to fill 2 hyperlink controls as well as a datalist control with table data using one call to the database. The page looks like this:

    <div id="PageContent">    
          Please select the district you wish to view below.</p>
          <asp:DropDownList ID="ddlDistrict" runat="server" CssClass="textbox" 
            DataTextField="DistrictName" DataValueField="DistrictId" AutoPostBack="True" 
        <p><asp:label ID="lblDistrictAbbrev" runat="server" Text="District Abbreviation: " />
          <asp:hyperlink ID="hyperlinkDistrictName" runat="server" 
            Text='' NavigateUrl="~/Contact/NationalCouncil.aspx" 
            Font-Bold="True" />
        <p><asp:label ID="lblDistrictCouncillor" runat="server" Text="District Councillor: " />
          <asp:hyperlink ID="hyperlinkCouncillor" runat="server" 
            Text='' NavigateUrl="~/Contact/NationalCouncil.a

    DetailsView Get Values on Insert. Major Problem :(



    I'm having a problem to get the inserted values from the detailsview. I've tried the following things:

               // Get Value from DropDown
            int TopicID = 0;
            foreach (DetailsViewRow row in ItemsDetailsView.Rows)
                if (row.Cells[0].Text == "Topic")
                     DropDownList TopicDropDown = (DropDownList)row.Cells[1].FindControl("Topic_TopicIDList");
                     TopicID = int.Parse(TopicDropDown.SelectedValue.ToString());
                MsgBox(CType(DetailsView1.Rows(1).Cells(0).Controls(0), Label))
                For Each row As DetailsViewRow In DetailsView1.Rows
                    Dim cell1 As TableCell = row.Cells(1)
                    Dim value1 As String
                    value1 = cell1.Text
                Dim item As New DetailsViewItem(col.ColumnName, row(index).ToString(), col.DataType.ToString(), col.DefaultValue)
                tb = DetailsView1.FindControl("Categorie")
                s = tb.Text
                For Each dvr As DetailsViewRow In DetailsView1.Rows
                    If dvr.Cells.Count = 2 Th

    Default (but overrideable) date in DetailsView problem


    I'm using a DetailsView control in Insert Mode (GridView for editing). I want to have today's date default into my date field, but the date has to be able to be overridden by the user.  

    I can bind it to the database element (1) OR I can default today's date (1) , but seeming not both. What am I doing wrong?

    (1) - Bind to database element

    <asp:TemplateField HeaderText="Date" SortExpression="EmployeeTimeDate">


          <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("EmployeeTimeDate") %>'></asp:TextBox>



          <asp:TextBox ID="TextBox1" runat="server" Text='<%# Bind("EmployeeTimeDate") %>'></asp:TextBox>



          <asp:Label ID="Label5" runat="server" Text='<%# Bind("EmployeeTimeDate", "{0:d}") %>'></asp:Label>



    Master-Detail with the GridView, DetailsView and jQuery's ThickBox

    One more article about grids from Matt Berseth. This time he shows how to create master-detail with the gridview, detailsview and jQuery's ThickBox. He writes:
    So I thought I would check some of this out and along the way rebuild my Master-Detail with the GridView, DetailView and ModalPopup Controls and replace the ModalPopup with jQuery's ThickBox. I found it pretty interesting - read on to see how it went

    Problem to group radio button across gridview rows

    In general no one can easily group or make a single selection from radio button list inside gridview rows. There are a lot of way to make a single or unique selection from list. Here i want to share how i can address this problem in the most easiest way. Googling the problem most of the cases i saw the grouping in horizontal way. Thats why i tried to group the radio buttons in vertical manner. Let i have a requirement like below:

    Regrading Sharpoint 2010 problem and solutions

    We can write your question and problem on this blogger.you get ans.use.

    This sharpoint 2010 problem solving threads

    Hi friend,

    you can use this thread to solving problem and solutions.

    Virtual Path Problem


     I get the following error on last line below (working on remote host): 'E:\web\sfcascom\ls_admin/uploads/images/001.JPG' is not a valid virtual path,

    Note that the slashes go in different directions

    I've tried a number of things but nothing seems to work. Thanks-


    Imports System.Drawing
    Imports System.Drawing.Drawing2D
    Imports System.Drawing.Imaging
    Imports System.Web.UI.WebControls
    Imports System.Drawing.Imaging.ImageCodecInfo
    Partial Class Protected_imageupload
        Inherits System.Web.UI.Page
        Private Sub btnUpload_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnUpload.Click
            ' Initialize variables
            Dim sSavePath As String
            Dim sThumbExtension As String
            Dim intThumbWidth As Integer
            Dim intThumbHeight As Integer
            Dim sFilename As String = ""
            ' Set constant values
            'sSavePath = "images/"
            sSavePath = Server.MapPath("~/") + "ls_admin/uploads/images/"
            sThumbExtension = "_thumb"
            intThumbWidth = 160
            intThumbHeight = 120
            ' If file field isn?t empty
            If FilUpload.PostedFile IsNot Nothing Then
                ' Check file size (mustn?t be 0)
                Dim myFile As Http
    ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
    Sql Server  SharePoint  Silverlight  Others  All   

    Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend