Solved

very complex asp.net repeater data capture for the textbox

Posted on 2010-09-24
10
560 Views
Last Modified: 2012-06-21
hi
i want to insert as many rows as created via the repeater basically the textbox object is a sub repeater within anoter parent datalist item which turned into repeater from the code behind

this is the code for this dynamic textbox object

 Repeater SecEventsTB = ((Repeater)e.Item.FindControl("SecEventsTB"));
             GraphicTemplateTableAdapter dbs = new GraphicTemplateTableAdapter();
             DataTable dst = dbs.GetGraphicTemplateByUserIDandshowidtext(Convert.ToInt32(Session["UserID"].ToString()), usershowid);
             SecEventsTB.DataSource = dst.DefaultView;
             SecEventsTB.DataBind();

  <asp:Repeater id="SecEventsTB" runat="server">
    <ItemTemplate>
        <asp:textbox id="mytb" runat="server" />
    </ItemTemplate>
<asp:DataList runat="server" ID="scheduleDay" OnItemDataBound="scheduleDay_ItemDataBound">
                                    <ItemTemplate>
                                       <div id="AJAXUpdateRecordRow">
                                                    <tr>
                                                   
                                                        <asp:HiddenField runat="server" ID="ShowIDs" Value='<%# DataBinder.Eval(Container.DataItem, "VideoItemID") %>' />
                                                          <asp:HiddenField runat="server" ID="Vname" Value='<%# DataBinder.Eval(Container.DataItem, "VideoItemName") %>' />
        
                                                    
                                                        <td class="ttc" ><asp:label runat="server" id="starttime" Text='<%# Eval("VideoStartTime") %>' /></td>
                                                        <td class="ttc" ><asp:Literal runat="server" id="Show" Text='<%# Eval("ScheduleSlotId") %>' /></td>
                                                         
                                                                        <td class="ttc" ><asp:Literal runat="server" id="VideoItemName" Text='<%# Eval("VideoItemName") %>' /></td>
                                               
                                                     <td class="ttc" ><asp:Literal runat="server" id="Literal2" Text='<%# Eval("showname") %>' /></td>
                                                                           <td class="ttc" ><asp:Literal runat="server" id="Literal1" Text='<%# Eval("itemorder") %>' /></td>
                            <asp:HiddenField runat="server" id="usershowid" Value='<%# Eval("showid") %>' />
                                                      <asp:HiddenField runat="server" id="placement" Value='<%# Eval("PlacementID") %>' />
                                                  <asp:HiddenField runat="server" id="ItemType" Value='<%# Eval("Videoitemtype") %>' />
                                                  <asp:HiddenField runat="server" id="starttimes" Value='<%# Eval("VideoStartTime") %>' />
                                                  <asp:HiddenField runat="server" id="ScheduledSlotId" Value='<%# Eval("ScheduledSlotId") %>' />
                                                    <asp:HiddenField runat="server" id="ItemOrder" Value='<%# Eval("ItemOrder") %>' />
                             <td class="ttc" >
                             
                           <BCS:BCSUSL runat="server" ID="Drop" />
                                             <asp:Label runat="server" ID="ERRShow" ForeColor="red" Font-Bold="true" />         
                                                <asp:CheckBoxList ID="SecEvents" runat="server">
                                           </asp:CheckBoxList>
                                           </td>
                                            <td class="ttc" >
                                                <asp:TextBox ID="TextualEvents" runat="server" Visible="False"></asp:TextBox>
                                            <asp:Repeater id="SecEventsTB" runat="server">
    <ItemTemplate>
        <asp:textbox id="mytb" runat="server" />
    </ItemTemplate>
</asp:Repeater>

                                    
                        </tr>
                                           
                               <asp:HiddenField runat="server" id="Rating" Value='<%# Eval("VideoItemID") %>' />
                               
                                                    </tr>
                                                    </div>
                                                </ITEMTEMPLATE>
                                                </asp:DataList>


public void scheduleDay_ItemDataBound(object sender, DataListItemEventArgs e)
    {
        try
        {
            string placement = ((HiddenField)e.Item.FindControl("placement")).Value;
            string usershowid = ((HiddenField)e.Item.FindControl("usershowid")).Value;
            string ItemType = ((HiddenField)e.Item.FindControl("ItemType")).Value;

            int itemtypes = Convert.ToInt32(ItemType);
            if (ItemType == "1")
            {
                DropDownList myDropDownList = (DropDownList)e.Item.FindControl("Drop").Controls[0]; 
                UserSegmentsListTableAdapter da = new UserSegmentsListTableAdapter();
                DataTable dt = da.GetUserListSegments(Convert.ToInt32(Session["UserID"].ToString()));
                myDropDownList.DataSource = dt.DefaultView;
                myDropDownList.DataTextField = dt.Columns["VideoItemName"].ToString();
                myDropDownList.DataValueField = dt.Columns["VideoItemId"].ToString();
                myDropDownList.DataBind();
                myDropDownList.Items.Insert(0, new ListItem("-- Please Select --", "0"));
                string vname = ((HiddenField)e.Item.FindControl("Vname")).Value;
                string ShowIDs = ((HiddenField)e.Item.FindControl("ShowIDs")).Value;
                //DropDownList myDropDownList = (DropDownList)e.Item.FindControl("Dropdownlist1");
                
                
                // DropDownList myDropDownLists = (DropDownList)e.Item.FindControl("SlotShow");
           myDropDownList.Items.Add(new ListItem(vname, ShowIDs));

             myDropDownList.SelectedValue = ShowIDs;

             CheckBoxList SecEvents = ((CheckBoxList)e.Item.FindControl("SecEvents"));
             GraphicTemplateTableAdapter db = new GraphicTemplateTableAdapter();
             DataTable ds = db.GetGraphicTemplateByUserIDandshowid(Convert.ToInt32(Session["UserID"].ToString()), usershowid);
             SecEvents.DataSource = ds.DefaultView;
             SecEvents.DataTextField = ds.Columns["GraphicTemplateName"].ToString();
             SecEvents.DataValueField = ds.Columns["GraphicTemplateId"].ToString();
             SecEvents.DataBind();

             TextBox TextualEvents = ((TextBox)e.Item.FindControl("TextualEvents"));


             TextualEvents.Visible = false;
             Repeater SecEventsTB = ((Repeater)e.Item.FindControl("SecEventsTB"));
             GraphicTemplateTableAdapter dbs = new GraphicTemplateTableAdapter();
             DataTable dst = dbs.GetGraphicTemplateByUserIDandshowidtext(Convert.ToInt32(Session["UserID"].ToString()), usershowid);
             SecEventsTB.DataSource = dst.DefaultView;
             SecEventsTB.DataBind();
            

         
           

            
             
            }


//method i want to repliace for the N numbers of textboxes
 void SavingDataListItems()
    {
        // saving required advertizing time

        // saving DataList slots shows
      
        DataList rep = scheduleDay;
        for (int i = 0; i < rep.Items.Count; i++)
        {
            try
            {
               
                try
                {
                    
                }
                catch (Exception exshow)
                {
                    Helper.StoreErrLog("UserSchedules", "SavingDataListItems", exshow.ToString());
                }

                CheckBoxList SecEvents = ((CheckBoxList)rep.Items[i].FindControl("SecEvents"));
            

                foreach (ListItem li in SecEvents.Items)
                {
                    if (li.Selected)
                    {
                        string strSelectedItemText = li.Text;
                        string strSelectedItemValue = li.Value;
                        //Insert Function 
                        //This will repeat for the checked items of the checkboxlists
                        //If N Checkboxes Get Selected the insert will be called for N Times
              
                int SEVideoItemID = 0;
                SEVideoItemID = Convert.ToInt32(((DropDownList)rep.Items[i].FindControl("Drop").Controls[0]).SelectedValue);
                string ItemType = ((HiddenField)rep.Items[i].FindControl("ItemType")).Value;
                int itemtypes = Convert.ToInt32(ItemType);
                string starttime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                string ShowIDs = ((HiddenField)rep.Items[i].FindControl("usershowid")).Value;
                int SEScheduleID = Convert.ToInt32(ScheduleID.Value);
                string ScheduledSlotId = ((HiddenField)rep.Items[i].FindControl("ScheduledSlotId")).Value;
                int SEScheduledSlotId = Convert.ToInt32(ScheduledSlotId);
                int SEShowID = Convert.ToInt32(ShowIDs);
                DateTime itemstarttime = Convert.ToDateTime(starttime);
                string ItemOrder = ((HiddenField)rep.Items[i].FindControl("ItemOrder")).Value;
                int SEItemOrder = Convert.ToInt32(ItemOrder);
                string VideoStartTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoStartTime = Convert.ToDateTime(VideoStartTime);
                string VideoEndTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoEndTime = Convert.ToDateTime(VideoEndTime);
                string VideoLength = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoLength = Convert.ToDateTime(VideoLength);
                int SEUserid = Convert.ToInt32(Session["UserID"].ToString());
              string SecEvent = ((HiddenField)rep.Items[i].FindControl("ItemOrder")).Value;
                int SESecEvent = Convert.ToInt32(SecEvent);
                string SESecEventText = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                string[] paramTypes = { "@ScheduleID", "@ScheduledSlotId", "@VideoItemID", "@ItemOrder "
                                      ,"@VideoStartTime", "@VideoEndTime", "@VideoLength","@Userid","@showid" ,"@SecEvent", 
                                      "@SecEventText" };
                object[] paramValues = { SEScheduleID, SEScheduledSlotId, SEVideoItemID, SEItemOrder, SEVideoStartTime,
                                       SEVideoEndTime, SEVideoLength, SEUserid,SEShowID, strSelectedItemValue, SESecEventText};
                    DBManager.ExecuteSQLSP("UpdateSecEventsandSchedle", paramTypes, paramValues);
                   ((Label)rep.Items[i].FindControl("ERRShow")).Text = "";
                    }
                }
            }
            catch (Exception ex)
            {
                ERRMain.Text = ex.Message.ToString();
                Helper.StoreErrLog("UserSchedules", "Executing UpdateSecEventsandSchedle", ex.ToString());
            }
        }
    }

Open in new window

0
Comment
Question by:mattibutt
  • 8
  • 2
10 Comments
 
LVL 3

Expert Comment

by:revaluser
ID: 33754805
foreach (RepeaterItem riItem in Repeater1.Items)
        {
            TextBox txt = (TextBox)riItem.FindControl("TextBoxIdFromrepeater");
            if (txt != null)//check wweather the textbox exists or not in that repeater
            {
                //Use that Text box object as the normal textbox value
                //and this Iteration will run for all the repeater items
                //i.e.., How many rows exists that many time this will be looped
            }
        }
0
 
LVL 11

Author Comment

by:mattibutt
ID: 33755402
hi
i have created the method now the issue is its in the conflict with the first logic prior to adding the text box logic i was only able to insert the selected checkbox item which was great but now its inserting alot of additional rows and causing confusion how can i make the code as one logic
void SavingDataListItems()
    {

        try
        {
                int pScheduleID = Convert.ToInt32(ScheduleID.Value);
            string[] paramType = { "@ScheduleID" };
            object[] paramValue = { pScheduleID };
            DBManager.ExecuteSQLSP("UpdateSecEventsandSchedledelete", paramType, paramValue);
        }
        catch (Exception exshow)
        {
            Helper.StoreErrLog("UserSchedules", "SavingDataListItems", exshow.ToString());
        }
        DataList rep = scheduleDay;
        for (int i = 0; i < rep.Items.Count; i++)
        {

            try
            {
               
                try
                {
                    
                }
                catch (Exception exshow)
                {
                    Helper.StoreErrLog("UserSchedules", "SavingDataListItems", exshow.ToString());
                }

                CheckBoxList SecEvents = ((CheckBoxList)rep.Items[i].FindControl("SecEvents"));
            

                foreach (ListItem li in SecEvents.Items)
                {
                    if (li.Selected)
                    {
                        string strSelectedItemText = li.Text;
                        string strSelectedItemValue = li.Value;
                        //Insert Function 
                        //This will repeat for the checked items of the checkboxlists
                        //If N Checkboxes Get Selected the insert will be called for N Times
              
                int SEVideoItemID = 0;
                SEVideoItemID = Convert.ToInt32(((DropDownList)rep.Items[i].FindControl("Drop").Controls[0]).SelectedValue);
                string ItemType = ((HiddenField)rep.Items[i].FindControl("ItemType")).Value;
                int itemtypes = Convert.ToInt32(ItemType);
                string starttime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                string ShowIDs = ((HiddenField)rep.Items[i].FindControl("usershowid")).Value;
                int SEScheduleID = Convert.ToInt32(ScheduleID.Value);
                string ScheduledSlotId = ((HiddenField)rep.Items[i].FindControl("ScheduledSlotId")).Value;
                int SEScheduledSlotId = Convert.ToInt32(ScheduledSlotId);
                int SEShowID = Convert.ToInt32(ShowIDs);
                DateTime itemstarttime = Convert.ToDateTime(starttime);
                string ItemOrder = ((HiddenField)rep.Items[i].FindControl("ItemOrder")).Value;
                int SEItemOrder = Convert.ToInt32(ItemOrder);
                string VideoStartTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoStartTime = Convert.ToDateTime(VideoStartTime);
                string VideoEndTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoEndTime = Convert.ToDateTime(VideoEndTime);
                string VideoLength = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoLength = Convert.ToDateTime(VideoLength);
                int SEUserid = Convert.ToInt32(Session["UserID"].ToString());
              string SecEvent = ((HiddenField)rep.Items[i].FindControl("ItemOrder")).Value;
                int SESecEvent = Convert.ToInt32(SecEvent);
                string SESecEventText = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;

                int pScheduleID = Convert.ToInt32(ScheduleID.Value);
                //DateTime pAdRequiredTime = Helper.FormatVideoLength(reqAdvertizing.Text);
    
                // saving required advertizing time

                // saving DataList slots shows        
                        
                        
                        string[] paramTypes = { "@ScheduleID", "@ScheduledSlotId", "@VideoItemID", "@ItemOrder "
                                      ,"@VideoStartTime", "@VideoEndTime", "@VideoLength","@Userid","@showid" ,"@SecEvent", 
                                      "@SecEventText" };
                object[] paramValues = { SEScheduleID, SEScheduledSlotId, SEVideoItemID, SEItemOrder, SEVideoStartTime,
                                       SEVideoEndTime, SEVideoLength, SEUserid,SEShowID, strSelectedItemValue, SESecEventText};
                    DBManager.ExecuteSQLSP("UpdateSecEventsandSchedle", paramTypes, paramValues);
                   ((Label)rep.Items[i].FindControl("ERRShow")).Text = "";
                    }

                    Repeater Repeater1 = ((Repeater)rep.Items[i].FindControl("SecEventsTB"));
foreach (RepeaterItem riItem in Repeater1.Items)
        {
            TextBox txt = (TextBox)riItem.FindControl("mytb");
            if (txt != null)//check wweather the textbox exists or not in that repeater
            {


                int SEVideoItemID = 0;
                SEVideoItemID = Convert.ToInt32(((DropDownList)rep.Items[i].FindControl("Drop").Controls[0]).SelectedValue);
                string ItemType = ((HiddenField)rep.Items[i].FindControl("ItemType")).Value;
                int itemtypes = Convert.ToInt32(ItemType);
                string starttime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                string ShowIDs = ((HiddenField)rep.Items[i].FindControl("usershowid")).Value;
                int SEScheduleID = Convert.ToInt32(ScheduleID.Value);
                string ScheduledSlotId = ((HiddenField)rep.Items[i].FindControl("ScheduledSlotId")).Value;
                int SEScheduledSlotId = Convert.ToInt32(ScheduledSlotId);
                int SEShowID = Convert.ToInt32(ShowIDs);
                DateTime itemstarttime = Convert.ToDateTime(starttime);
                string ItemOrder = ((HiddenField)rep.Items[i].FindControl("ItemOrder")).Value;
                int SEItemOrder = Convert.ToInt32(ItemOrder);
                string VideoStartTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoStartTime = Convert.ToDateTime(VideoStartTime);
                string VideoEndTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoEndTime = Convert.ToDateTime(VideoEndTime);
                string VideoLength = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoLength = Convert.ToDateTime(VideoLength);
                int SEUserid = Convert.ToInt32(Session["UserID"].ToString());
                string SecEvent = ((HiddenField)rep.Items[i].FindControl("ItemOrder")).Value;
                int SESecEvent = Convert.ToInt32(SecEvent);
                string SESecEventText = txt.Text;

                int pScheduleID = Convert.ToInt32(ScheduleID.Value);
                //DateTime pAdRequiredTime = Helper.FormatVideoLength(reqAdvertizing.Text);

                // saving required advertizing time

                // saving DataList slots shows        


                string[] paramTypes = { "@ScheduleID", "@ScheduledSlotId", "@VideoItemID", "@ItemOrder "
                                      ,"@VideoStartTime", "@VideoEndTime", "@VideoLength","@Userid","@showid" ,"@SecEvent", 
                                      "@SecEventText" };
                object[] paramValues = { SEScheduleID, SEScheduledSlotId, SEVideoItemID, SEItemOrder, SEVideoStartTime,
                                       SEVideoEndTime, SEVideoLength, SEUserid,SEShowID, SESecEvent, SESecEventText};
                DBManager.ExecuteSQLSP("UpdateSecEventsandSchedle", paramTypes, paramValues);
                ((Label)rep.Items[i].FindControl("ERRShow")).Text = "";
                //Use that Text box object as the normal textbox value
                //and this Iteration will run for all the repeater items 
                //i.e.., How many rows exists that many time this will be looped
            }
        }
          
                }
            }
            catch (Exception ex)
            {
                ERRMain.Text = ex.Message.ToString();
                Helper.StoreErrLog("UserSchedules", "Executing UpdateSecEventsandSchedle", ex.ToString());
            }



        }
    }

Open in new window

0
 
LVL 3

Accepted Solution

by:
revaluser earned 500 total points
ID: 33760621
There need to be 2 Tables

1. for saving the Textbox value and in return get Primary Value From it

2. Another table where u need to insert the checkbox selected values + the Foriegn Kay value which refers the above Statement primary key

1st Table Columns

PrimaryKey(Identity would be better)
Textbox value
.
.
.
.

2 nd Table
PrimaryKey(Identity would be better)
Forien Key (Refers the above table)
Checkbox value


and the process of saving is in the iteration 1st save the Textbox value get the primary key value

then now use the primary key value as the forien key for the checkbox iteration
0
 
LVL 11

Author Comment

by:mattibutt
ID: 33761006
hi
do you think it wouldn't be possible to add both in the same table cause i see the problem to be different, the textbox reference is added as a row even if the row is empty seems to me following logic is not working properly

if (txt != null)//check wweather the textbox exists or not in that repeater
            {

the way my stored procedure is executed i can not insert txt straight to the database it needs to be converted to the string

  string SESecEventText = txt.Text;
if someway this is asserted by ensuring that this is not null then i think it might just work with one table

please advise

thanks
0
 
LVL 11

Author Comment

by:mattibutt
ID: 33761026
i meant even when the textbox is empty the whole record row is inserted in the database and text or maybe i should add the textbox column as not null so when the value is not null then it wouldnt enter the row at all
0
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 11

Author Comment

by:mattibutt
ID: 33761435
hi
i have created a trigger in the table now it is automatically deleting blank records but now the issue is basically it is inserting each textbox value as two rows
0
 
LVL 11

Author Comment

by:mattibutt
ID: 33763787
hi
please have a look at the codes now i am only dealing with the issue of textbox values are inserted twice however checkbox values are inserted once i do not know what is causing this i have tried everything
i am attaching the codes
codes
mssql

ALTER PROCEDURE [dbo].[UpdateSecEventsandSchedle]

	
	@ScheduleID int,
	@ScheduledSlotId int,
	@VideoItemID int,
	@ItemOrder int,
	@VideoStartTime datetime,
	@VideoEndTime datetime,
	@VideoLength datetime ,
	@Userid int,
	@showid int,
	@SecEvent int,
	@SecEventText varchar 
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	SET NOCOUNT ON;
Declare @sVideoItemID varchar

set  @sVideoItemID = @SecEventText

    --  delete  FROM SlotVideoItemsevents WHERE ScheduleID=@ScheduleID
		INSERT INTO SlotVideoItemsevents
           ([ScheduleID]
           ,[ScheduledSlotId]
           ,[VideoItemID]
           ,[ItemOrder]
           ,[VideoStartTime]
           ,[VideoEndTime]
           ,[VideoLength]
           ,[Userid]
           ,[Showid]
           ,[SecEvent] 
	,[SecEventText] )
VALUES     

(@ScheduleID ,
	@ScheduledSlotId ,
	@VideoItemID ,
	@ItemOrder ,
	@VideoStartTime ,
	@VideoEndTime ,
	@VideoLength  ,
	@Userid,
	@showid,
	@SecEvent,
	@sVideoItemID )
		END



ALTER TRIGGER [dbo].[trg_auto_deleteemptytext]
  ON [dbo].[SlotVideoItemsevents]
 FOR INSERT
AS
BEGIN
  IF 0<= ( SELECT COUNT(*) FROM SlotVideoItemsevents )
  BEGIN
    SET ROWCOUNT 0

  
   DELETE TOP (100) PERCENT
FROM         SlotVideoItemsevents
  where SecEventText = ''
    SET ROWCOUNT 0
  END
 
END


//asp.net code behind
void SavingDataListItems()
    {

        try
        {
                int pScheduleID = Convert.ToInt32(ScheduleID.Value);
            string[] paramType = { "@ScheduleID" };
            object[] paramValue = { pScheduleID };
            DBManager.ExecuteSQLSP("UpdateSecEventsandSchedledelete", paramType, paramValue);
        }
        catch (Exception exshow)
        {
            Helper.StoreErrLog("UserSchedules", "SavingDataListItems", exshow.ToString());
        }
        DataList rep = scheduleDay;
        for (int i = 0; i < rep.Items.Count; i++)
        {

            try
            {
               
                try
                {
                    
                }
                catch (Exception exshow)
                {
                    Helper.StoreErrLog("UserSchedules", "SavingDataListItems", exshow.ToString());
                }

                CheckBoxList SecEvents = ((CheckBoxList)rep.Items[i].FindControl("SecEvents"));
            

                foreach (ListItem li in SecEvents.Items)
                {
                    if (li.Selected)
                    {
                        string strSelectedItemText = li.Text;
                        string strSelectedItemValue = li.Value;
                        //Insert Function 
                        //This will repeat for the checked items of the checkboxlists
                        //If N Checkboxes Get Selected the insert will be called for N Times
              
                int SEVideoItemID = 0;
                SEVideoItemID = Convert.ToInt32(((DropDownList)rep.Items[i].FindControl("Drop").Controls[0]).SelectedValue);
                string ItemType = ((HiddenField)rep.Items[i].FindControl("ItemType")).Value;
                int itemtypes = Convert.ToInt32(ItemType);
                string starttime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                string ShowIDs = ((HiddenField)rep.Items[i].FindControl("usershowid")).Value;
                int SEScheduleID = Convert.ToInt32(ScheduleID.Value);
                string ScheduledSlotId = ((HiddenField)rep.Items[i].FindControl("ScheduledSlotId")).Value;
                int SEScheduledSlotId = Convert.ToInt32(ScheduledSlotId);
                int SEShowID = Convert.ToInt32(ShowIDs);
                DateTime itemstarttime = Convert.ToDateTime(starttime);
                string ItemOrder = ((HiddenField)rep.Items[i].FindControl("ItemOrder")).Value;
                int SEItemOrder = Convert.ToInt32(ItemOrder);
                string VideoStartTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoStartTime = Convert.ToDateTime(VideoStartTime);
                string VideoEndTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoEndTime = Convert.ToDateTime(VideoEndTime);
                string VideoLength = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoLength = Convert.ToDateTime(VideoLength);
                int SEUserid = Convert.ToInt32(Session["UserID"].ToString());
              string SecEvent = ((HiddenField)rep.Items[i].FindControl("ItemOrder")).Value;
                int SESecEvent = Convert.ToInt32(SecEvent);
                string SESecEventText = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;

                int pScheduleID = Convert.ToInt32(ScheduleID.Value);
                //DateTime pAdRequiredTime = Helper.FormatVideoLength(reqAdvertizing.Text);
    
                // saving required advertizing time

                // saving DataList slots shows        
                        
                        
                        string[] paramTypes = { "@ScheduleID", "@ScheduledSlotId", "@VideoItemID", "@ItemOrder "
                                      ,"@VideoStartTime", "@VideoEndTime", "@VideoLength","@Userid","@showid" ,"@SecEvent", 
                                      "@SecEventText" };
                object[] paramValues = { SEScheduleID, SEScheduledSlotId, SEVideoItemID, SEItemOrder, SEVideoStartTime,
                                       SEVideoEndTime, SEVideoLength, SEUserid,SEShowID, strSelectedItemValue, SESecEventText};
                    DBManager.ExecuteSQLSP("UpdateSecEventsandSchedle", paramTypes, paramValues);
                   ((Label)rep.Items[i].FindControl("ERRShow")).Text = "";
                    }

                    Repeater Repeater1 = ((Repeater)rep.Items[i].FindControl("SecEventsTB"));
foreach (RepeaterItem riItem in Repeater1.Items)
        {
            TextBox txt = (TextBox)riItem.FindControl("mytb");
            TextBox gid = (TextBox)riItem.FindControl("GraphicID");

            if (txt != null)//check wweather the textbox exists or not in that repeater
            {


                int SEVideoItemID = 0;
                SEVideoItemID = Convert.ToInt32(((DropDownList)rep.Items[i].FindControl("Drop").Controls[0]).SelectedValue);
                string ItemType = ((HiddenField)rep.Items[i].FindControl("ItemType")).Value;
                int itemtypes = Convert.ToInt32(ItemType);
                string starttime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                string ShowIDs = ((HiddenField)rep.Items[i].FindControl("usershowid")).Value;
                int SEScheduleID = Convert.ToInt32(ScheduleID.Value);
                string ScheduledSlotId = ((HiddenField)rep.Items[i].FindControl("ScheduledSlotId")).Value;
                int SEScheduledSlotId = Convert.ToInt32(ScheduledSlotId);
                int SEShowID = Convert.ToInt32(ShowIDs);
                DateTime itemstarttime = Convert.ToDateTime(starttime);
                string ItemOrder = ((HiddenField)rep.Items[i].FindControl("ItemOrder")).Value;
                int SEItemOrder = Convert.ToInt32(ItemOrder);
                string VideoStartTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoStartTime = Convert.ToDateTime(VideoStartTime);
                string VideoEndTime = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoEndTime = Convert.ToDateTime(VideoEndTime);
                string VideoLength = ((HiddenField)rep.Items[i].FindControl("starttimes")).Value;
                DateTime SEVideoLength = Convert.ToDateTime(VideoLength);
                int SEUserid = Convert.ToInt32(Session["UserID"].ToString());
                string SecEvent = gid.Text;
                int SESecEvent = Convert.ToInt32(SecEvent);
                string SESecEventText = txt.Text;

                int pScheduleID = Convert.ToInt32(ScheduleID.Value);
                //DateTime pAdRequiredTime = Helper.FormatVideoLength(reqAdvertizing.Text);

                // saving required advertizing time

                // saving DataList slots shows        


                string[] paramTypes = { "@ScheduleID", "@ScheduledSlotId", "@VideoItemID", "@ItemOrder "
                                      ,"@VideoStartTime", "@VideoEndTime", "@VideoLength","@Userid","@showid" ,"@SecEvent", 
                                      "@SecEventText" };
                object[] paramValues = { SEScheduleID, SEScheduledSlotId, SEVideoItemID, SEItemOrder, SEVideoStartTime,
                                       SEVideoEndTime, SEVideoLength, SEUserid,SEShowID, SESecEvent, SESecEventText};
                DBManager.ExecuteSQLSP("UpdateSecEventsandSchedle", paramTypes, paramValues);
                ((Label)rep.Items[i].FindControl("ERRShow")).Text = "";
                //Use that Text box object as the normal textbox value
                //and this Iteration will run for all the repeater items 
                //i.e.., How many rows exists that many time this will be looped
            }
        }
          
                }
            }
            catch (Exception ex)
            {
                ERRMain.Text = ex.Message.ToString();
                Helper.StoreErrLog("UserSchedules", "Executing UpdateSecEventsandSchedle", ex.ToString());
            }

Open in new window

0
 
LVL 11

Author Closing Comment

by:mattibutt
ID: 33765743
the problem is solved by getting some other opinion but thanks so much
0
 
LVL 11

Author Comment

by:mattibutt
ID: 33765747
now i am having to deal with another issue with the same functionality let me know if its ok then i can post the link here
0
 
LVL 11

Author Comment

by:mattibutt
ID: 33771737
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
Duplicate a row 2 33
C# Problem Solving Execerscise 5 43
File Upload Control on a ASP.NET Overlay Page 1 26
C# TextBox 11 16
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
Performance in games development is paramount: every microsecond counts to be able to do everything in less than 33ms (aiming at 16ms). C# foreach statement is one of the worst performance killers, and here I explain why.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now