[CLOSED] How To Pass hidden value

  1. #1

    [CLOSED] How To Pass hidden value

    Hello

    I have a grid panel that when I do a Insert I would like to pass a hidden ID and Date fro my Handler. How is that possible to do it. When I do a Insert I able to create new ID but my database has 2 required fields that user doesn't input when on a Insert. Can anyone help on this.

    Thank you
  2. #2

    RE: [CLOSED] How To Pass hidden value

    Hi,

    I am not sure that correctly understood you. Can you show some code with problem place?

  3. #3

    RE: [CLOSED] How To Pass hidden value

    Hi Vladimir,

            <ext:Store ID="Store1" runat="server">
                <UpdateProxy>
                    <ext:HttpWriteProxy Method="POST" Url="mbCenterTab1.ashx" />
                </UpdateProxy>
                <Reader>
                    <ext:JsonReader ReaderID="Id">
                        <Fields>
                            <ext:RecordField Name="Name" Type="String" />
                            <ext:RecordField Name="Message" Type="String" />
                        </Fields>
                    </ext:JsonReader>
                </Reader>
                <Listeners>
                    <LoadException Handler="Ext.Msg.alert('Model Book: Load failed', e.message || response.statusText);" />
                    <SaveException Handler="Ext.Msg.alert('Model Book: Save', e.message || response.statusText);" />
                    <CommitDone Handler="Ext.Msg.alert('Model Book: Save', 'Saved successfully !');" />
                    <CommitFailed Handler="Ext.Msg.alert('Model Book: Error', 'Error: ' + msg);" />
                </Listeners>            
            </ext:Store>


                    <ext:GridPanel ID="GridPanel1" runat="server" StateId="Store1">
                        <ColumnModel ID="ctl01" runat="server">
                            <Columns>
                                <ext:Column DataIndex="Name" Hidden="true">
                                </ext:Column>
                                <ext:Column DataIndex="Message">
                                    <Editor>
                                        <ext:TextArea ID="txtMessage" runat="server" />
                                    </Editor>
                                </ext:Column>
                            </Columns>
                        </ColumnModel>
                        <BottomBar>
                            <ext:PagingToolBar ID="PagingToolBar" runat="server" PageSize="20" StoreID="dtaCenterTab1" />
                        </BottomBar>
                        <Buttons>
                            <ext:Button ID="btnInsert_GridPanel1" runat="server" Text="Insert" Icon="Add">
                                <Listeners>
                                    <Click Handler="var rowIndex = #{GridPanel1}.addRecord(); #{GridPanel1}.getView().focusRow(rowIndex); #{GridPanel1}.startEditing(rowIndex, 0);" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="btnDelete_GridPanel1" runat="server" Text="Delete" Icon="Delete" Disabled="true">
                                <Listeners>
                                    <Click Handler="#{GridPanel1}.deleteSelected();if (!#{GridPanel1}.hasSelection()) {#{btnDelete_GridPanel1}.disable();}" />
                                </Listeners>
                            </ext:Button>
                            <ext:Button ID="btnSave_GridPanel1" runat="server" Text="Save" Icon="Disk" AutoPostBack="false">
                                <Listeners>
                                    <Click Handler="#{GridPanel1}.save();" />
                                </Listeners>
                            </ext:Button>
                        </Buttons>
                        <LoadMask ShowMask="true" />
                        <SaveMask ShowMask="true" />                    
                    </ext:GridPanel>
    HttpHandler

    
    using System;
    using System.Data.Linq;
    using System.Web;
    using System.Web.Services;
    using Coolite.Ext.Web;
    
    namespace ModelBook.Web.Shared
    {
        /// <summary>
        /// Summary description for $codebehindclassname$
        /// </summary>
        [WebService(Namespace = "http://tempuri.org/")]
        [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
    
        public class mbCenterTab1Save : IHttpHandler
        {
    
            public void ProcessRequest(HttpContext context)
            {
    
                var dataHandler = new StoreDataHandler(context);
                var sr = new AjaxResponse(true);
    
                ConfirmationList confirmationList = dataHandler.BuildConfirmationList("MBPId");
    
                try
                {
                    var db = new ModelBookDataContext();
                    //StoreDataHandler dataHandler = new StoreDataHandler(context);
                    ChangeRecords<HSFGraphFund> data = dataHandler.ObjectData<HSFGraphFund>();
    
                    foreach (HSFGraphFund value in data.Deleted)
                    {
                        db.HSFGraphFunds.Attach(value);
                        db.HSFGraphFunds.DeleteOnSubmit(value);
    
                        confirmationList[value.MBPId.ToString()].ConfirmRecord();
                    }
    
                    foreach (HSFGraphFund value in data.Updated)
                    {
                        db.HSFGraphFunds.Attach(value);
                        db.Refresh(RefreshMode.KeepCurrentValues, value);
    
                        confirmationList[value.MBPId.ToString()].ConfirmRecord();
                    }
    
                    foreach (HSFGraphFund value in data.Created)
                    {
                        db.HSFGraphFunds.InsertOnSubmit(value);
    
                        confirmationList[value.MBPId.ToString()].ConfirmRecord();
    
                        confirmationList[value.MBPId.ToString()].ConfirmRecord("newId");
                    }
    
                    db.SubmitChanges();
                }
    
                catch (Exception e)
                {
                    sr.Success = false;
                    sr.Msg = e.Message;
                }
    
    
    
                var response = new StoreResponseData();
                response.Confirmation = confirmationList;
    
                sr.Data = response.ToString();
                sr.MakeAnswer();
    
            }
    
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
    
        }
    }

    Thank You.
  4. #4

    RE: [CLOSED] How To Pass hidden value

    Hi Zarzand,

    I apologize for new question but what problem place in your code?

    If you need to add additional information for every new row that you can use next code
    var rowIndex = #{GridPanel1}.addRecord();
    var record = #{GridPanel1}.store.getAt(rowIndex);
    record.data['param1'] = 'value1';
    if you need to pass additional parameters to save handler the you can define WriteBaseParams of Store

  5. #5

    RE: [CLOSED] How To Pass hidden value

    Can you please give an example.

    Thanks
  6. #6

    RE: [CLOSED] How To Pass hidden value

    How Can I Set a value from my combobox to my Insert handler?

    
    <Coolite:ComboBox ID="cboNorth" CausesValidation="true" FieldLabel="OSID" Width="150" StoreID="dtaNorthOSID" TriggerAction="All" Mode="Local" EmptyText="Select OSID" DisplayField="OSID" ValueField="OSID" ForceSelection="true" runat="server" Select&#111;nfocus="True">
    </Coolite:ComboBox>
    My Grid Listner

    
    <Listeners>
    <Click Handler="var rowIndex = #{grdCenterTap1}.addRecord(); var record = #{grdCenterTap1}.store.getAt(rowIndex); record.data['GraphDate'] = 'what goes here' />
    </Listeners>
  7. #7

    RE: [CLOSED] How To Pass hidden value

    Hi,

    if you need to have selected value from combobox for each new row then you could use next

    
    <Listeners>
    <Click Handler="var rowIndex = #{grdCenterTap1}.addRecord(); var record = #{grdCenterTap1}.store.getAt(rowIndex); record.data['GraphDate'] = #{cboNorth}.getValue();>
    </Listeners>
  8. #8

    RE: [CLOSED] How To Pass hidden value

    Thanks allot Vlad that worked perfectly

Similar Threads

  1. Replies: 5
    Last Post: Jun 26, 2012, 8:52 PM
  2. [CLOSED] How to pass extraparams tp directmethod?
    By feanor91 in forum 2.x Legacy Premium Help
    Replies: 2
    Last Post: Apr 19, 2012, 5:00 PM
  3. [CLOSED] To pass an Array using ajaxmethod
    By speedstepmem3 in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: Aug 31, 2009, 7:58 AM
  4. [CLOSED] Pass value of row to window with frame
    By CSG in forum 1.x Legacy Premium Help
    Replies: 1
    Last Post: May 26, 2009, 12:29 PM
  5. [CLOSED] Pass Parameters Using HttpProxy
    By LeeTheGreek in forum 1.x Legacy Premium Help
    Replies: 3
    Last Post: Feb 02, 2009, 12:00 PM

Posting Permissions