Solved

very complex asp.net repeater data capture for the textbox

Posted on 2010-09-24
10
565 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Optimizing Cloud Backup for Low Bandwidth

With cloud storage prices going down a growing number of SMBs start to use it for backup storage. Unfortunately, business data volume rarely fits the average Internet speed. This article provides an overview of main Internet speed challenges and reveals backup best practices.

 
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
 
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

Secure Your Active Directory - April 20, 2017

Active Directory plays a critical role in your company’s IT infrastructure and keeping it secure in today’s hacker-infested world is a must.
Microsoft published 300+ pages of guidance, but who has the time, money, and resources to implement? Register now to find an easier way.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
What is this datetime? 1 27
custom authorization on controller action and HTML in asp.net mvc 1 43
C# XML Get Values 4 34
SQL- GROUP BY 4 23
by Mark Wills Attending one of Rob Farley's seminars the other day, I heard the phrase "The Accidental DBA" and fell in love with it. It got me thinking about the plight of the newcomer to SQL Server...  So if you are the accidental DBA, or, simp…
IntroductionWhile developing web applications, a single page might contain many regions and each region might contain many number of controls with the capability to perform  postback. Many times you might need to perform some action on an ASP.NET po…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…
Attackers love to prey on accounts that have privileges. Reducing privileged accounts and protecting privileged accounts therefore is paramount. Users, groups, and service accounts need to be protected to help protect the entire Active Directory …

756 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