Defining parameters in SQLDatasource in devexpress












0















I have a SQLDataSource that has an insert statement and parameters defined, please see photo below:



enter image description here



As I run my program, it will always states that it cannot find the txtlName control. What is wrong with my implementation? Can someone tell how to fix this?



This is my mark up code for my sqldatasource.



<asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:MDRFConnectionString %>" InsertCommand="INSERT INTO MDRF_Main(MDRF_LName, MDRF_FName, MDRF_MName, MDRF_Department, MDRF_RequestType, MDRF_Status, MDRF_WorkflowId, MDRF_Company, MDRF_Remarks, MDRF_RequestModule, MDRF_DateRequired, MDRF_Priority, MDRF_ResponseTime, MDRF_Module, MDRF_DocNum) VALUES (@lname, @fname, @mname, @dept, @rt, @status, @work, @comp, @remarks, @rm, CONVERT(datetime, @date) , @prio, @response, @module, @dn)" OnSelecting="SqlDataSource4_Selecting" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [MDRF_Main]">
<InsertParameters>
<asp:ControlParameter ControlID="txtLname" Name="lname" PropertyName="Text" />
<asp:ControlParameter ControlID="txtFname" Name="fname" PropertyName="Text" />
<asp:ControlParameter ControlID="txtMname" Name="mname" PropertyName="Text" />
<asp:ControlParameter ControlID="cmbDepartment" Name="dept" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbRequestType" Name="rt" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbStatus" Name="status" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbWorkflow" Name="work" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbCompany" Name="comp" PropertyName="Value" />
<asp:ControlParameter ControlID="txtRemarks" Name="remarks" PropertyName="Text" />
<asp:ControlParameter ControlID="cmbMasterData" Name="rm" PropertyName="Value" />
<asp:ControlParameter ControlID="txtDate" Name="date" PropertyName="Date" DbType="DateTime" />
<asp:ControlParameter ControlID="cmbPriority" Name="prio" PropertyName="Value" />
<asp:ControlParameter ControlID="txtResponse" Name="response" PropertyName="Text" />
<asp:Parameter DefaultValue="''" Name="module" />
<asp:ControlParameter ControlID="txtDocNum" DefaultValue="" Name="dn" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>


Thanks










share|improve this question

























  • Please show the SqlDataSource and ASPxTextBox markup to let us find out possible cause of this issue. Try using txtLName_Init() event handler to see the unique ID, e.g. var textbox = sender as ASPxTextBox; Debug.WriteLine(textbox.UniqueID);.

    – Tetsuya Yamamoto
    Nov 21 '18 at 8:21











  • I have already the problem but whenever I enter the value for date it would always display error.

    – user3312649
    Nov 22 '18 at 1:56











  • Is that txtLname contained inside GridView's ItemTemplate or other container? If the textbox doesn't contained inside any container you can use the control name directly, but if using any container then you should use container name too, e.g. GridView1$txtLname.

    – Tetsuya Yamamoto
    Nov 22 '18 at 2:05











  • I recently just solved this, I have just put it inside the formlayout fields. sigh.

    – user3312649
    Nov 22 '18 at 3:45
















0















I have a SQLDataSource that has an insert statement and parameters defined, please see photo below:



enter image description here



As I run my program, it will always states that it cannot find the txtlName control. What is wrong with my implementation? Can someone tell how to fix this?



This is my mark up code for my sqldatasource.



<asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:MDRFConnectionString %>" InsertCommand="INSERT INTO MDRF_Main(MDRF_LName, MDRF_FName, MDRF_MName, MDRF_Department, MDRF_RequestType, MDRF_Status, MDRF_WorkflowId, MDRF_Company, MDRF_Remarks, MDRF_RequestModule, MDRF_DateRequired, MDRF_Priority, MDRF_ResponseTime, MDRF_Module, MDRF_DocNum) VALUES (@lname, @fname, @mname, @dept, @rt, @status, @work, @comp, @remarks, @rm, CONVERT(datetime, @date) , @prio, @response, @module, @dn)" OnSelecting="SqlDataSource4_Selecting" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [MDRF_Main]">
<InsertParameters>
<asp:ControlParameter ControlID="txtLname" Name="lname" PropertyName="Text" />
<asp:ControlParameter ControlID="txtFname" Name="fname" PropertyName="Text" />
<asp:ControlParameter ControlID="txtMname" Name="mname" PropertyName="Text" />
<asp:ControlParameter ControlID="cmbDepartment" Name="dept" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbRequestType" Name="rt" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbStatus" Name="status" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbWorkflow" Name="work" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbCompany" Name="comp" PropertyName="Value" />
<asp:ControlParameter ControlID="txtRemarks" Name="remarks" PropertyName="Text" />
<asp:ControlParameter ControlID="cmbMasterData" Name="rm" PropertyName="Value" />
<asp:ControlParameter ControlID="txtDate" Name="date" PropertyName="Date" DbType="DateTime" />
<asp:ControlParameter ControlID="cmbPriority" Name="prio" PropertyName="Value" />
<asp:ControlParameter ControlID="txtResponse" Name="response" PropertyName="Text" />
<asp:Parameter DefaultValue="''" Name="module" />
<asp:ControlParameter ControlID="txtDocNum" DefaultValue="" Name="dn" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>


Thanks










share|improve this question

























  • Please show the SqlDataSource and ASPxTextBox markup to let us find out possible cause of this issue. Try using txtLName_Init() event handler to see the unique ID, e.g. var textbox = sender as ASPxTextBox; Debug.WriteLine(textbox.UniqueID);.

    – Tetsuya Yamamoto
    Nov 21 '18 at 8:21











  • I have already the problem but whenever I enter the value for date it would always display error.

    – user3312649
    Nov 22 '18 at 1:56











  • Is that txtLname contained inside GridView's ItemTemplate or other container? If the textbox doesn't contained inside any container you can use the control name directly, but if using any container then you should use container name too, e.g. GridView1$txtLname.

    – Tetsuya Yamamoto
    Nov 22 '18 at 2:05











  • I recently just solved this, I have just put it inside the formlayout fields. sigh.

    – user3312649
    Nov 22 '18 at 3:45














0












0








0


1






I have a SQLDataSource that has an insert statement and parameters defined, please see photo below:



enter image description here



As I run my program, it will always states that it cannot find the txtlName control. What is wrong with my implementation? Can someone tell how to fix this?



This is my mark up code for my sqldatasource.



<asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:MDRFConnectionString %>" InsertCommand="INSERT INTO MDRF_Main(MDRF_LName, MDRF_FName, MDRF_MName, MDRF_Department, MDRF_RequestType, MDRF_Status, MDRF_WorkflowId, MDRF_Company, MDRF_Remarks, MDRF_RequestModule, MDRF_DateRequired, MDRF_Priority, MDRF_ResponseTime, MDRF_Module, MDRF_DocNum) VALUES (@lname, @fname, @mname, @dept, @rt, @status, @work, @comp, @remarks, @rm, CONVERT(datetime, @date) , @prio, @response, @module, @dn)" OnSelecting="SqlDataSource4_Selecting" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [MDRF_Main]">
<InsertParameters>
<asp:ControlParameter ControlID="txtLname" Name="lname" PropertyName="Text" />
<asp:ControlParameter ControlID="txtFname" Name="fname" PropertyName="Text" />
<asp:ControlParameter ControlID="txtMname" Name="mname" PropertyName="Text" />
<asp:ControlParameter ControlID="cmbDepartment" Name="dept" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbRequestType" Name="rt" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbStatus" Name="status" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbWorkflow" Name="work" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbCompany" Name="comp" PropertyName="Value" />
<asp:ControlParameter ControlID="txtRemarks" Name="remarks" PropertyName="Text" />
<asp:ControlParameter ControlID="cmbMasterData" Name="rm" PropertyName="Value" />
<asp:ControlParameter ControlID="txtDate" Name="date" PropertyName="Date" DbType="DateTime" />
<asp:ControlParameter ControlID="cmbPriority" Name="prio" PropertyName="Value" />
<asp:ControlParameter ControlID="txtResponse" Name="response" PropertyName="Text" />
<asp:Parameter DefaultValue="''" Name="module" />
<asp:ControlParameter ControlID="txtDocNum" DefaultValue="" Name="dn" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>


Thanks










share|improve this question
















I have a SQLDataSource that has an insert statement and parameters defined, please see photo below:



enter image description here



As I run my program, it will always states that it cannot find the txtlName control. What is wrong with my implementation? Can someone tell how to fix this?



This is my mark up code for my sqldatasource.



<asp:SqlDataSource ID="SqlDataSource4" runat="server" ConnectionString="<%$ ConnectionStrings:MDRFConnectionString %>" InsertCommand="INSERT INTO MDRF_Main(MDRF_LName, MDRF_FName, MDRF_MName, MDRF_Department, MDRF_RequestType, MDRF_Status, MDRF_WorkflowId, MDRF_Company, MDRF_Remarks, MDRF_RequestModule, MDRF_DateRequired, MDRF_Priority, MDRF_ResponseTime, MDRF_Module, MDRF_DocNum) VALUES (@lname, @fname, @mname, @dept, @rt, @status, @work, @comp, @remarks, @rm, CONVERT(datetime, @date) , @prio, @response, @module, @dn)" OnSelecting="SqlDataSource4_Selecting" ProviderName="System.Data.SqlClient" SelectCommand="SELECT * FROM [MDRF_Main]">
<InsertParameters>
<asp:ControlParameter ControlID="txtLname" Name="lname" PropertyName="Text" />
<asp:ControlParameter ControlID="txtFname" Name="fname" PropertyName="Text" />
<asp:ControlParameter ControlID="txtMname" Name="mname" PropertyName="Text" />
<asp:ControlParameter ControlID="cmbDepartment" Name="dept" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbRequestType" Name="rt" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbStatus" Name="status" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbWorkflow" Name="work" PropertyName="Value" />
<asp:ControlParameter ControlID="cmbCompany" Name="comp" PropertyName="Value" />
<asp:ControlParameter ControlID="txtRemarks" Name="remarks" PropertyName="Text" />
<asp:ControlParameter ControlID="cmbMasterData" Name="rm" PropertyName="Value" />
<asp:ControlParameter ControlID="txtDate" Name="date" PropertyName="Date" DbType="DateTime" />
<asp:ControlParameter ControlID="cmbPriority" Name="prio" PropertyName="Value" />
<asp:ControlParameter ControlID="txtResponse" Name="response" PropertyName="Text" />
<asp:Parameter DefaultValue="''" Name="module" />
<asp:ControlParameter ControlID="txtDocNum" DefaultValue="" Name="dn" PropertyName="Text" />
</InsertParameters>
</asp:SqlDataSource>


Thanks







devexpress sqldatasource






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 1:57







user3312649

















asked Nov 20 '18 at 13:10









user3312649user3312649

921113




921113













  • Please show the SqlDataSource and ASPxTextBox markup to let us find out possible cause of this issue. Try using txtLName_Init() event handler to see the unique ID, e.g. var textbox = sender as ASPxTextBox; Debug.WriteLine(textbox.UniqueID);.

    – Tetsuya Yamamoto
    Nov 21 '18 at 8:21











  • I have already the problem but whenever I enter the value for date it would always display error.

    – user3312649
    Nov 22 '18 at 1:56











  • Is that txtLname contained inside GridView's ItemTemplate or other container? If the textbox doesn't contained inside any container you can use the control name directly, but if using any container then you should use container name too, e.g. GridView1$txtLname.

    – Tetsuya Yamamoto
    Nov 22 '18 at 2:05











  • I recently just solved this, I have just put it inside the formlayout fields. sigh.

    – user3312649
    Nov 22 '18 at 3:45



















  • Please show the SqlDataSource and ASPxTextBox markup to let us find out possible cause of this issue. Try using txtLName_Init() event handler to see the unique ID, e.g. var textbox = sender as ASPxTextBox; Debug.WriteLine(textbox.UniqueID);.

    – Tetsuya Yamamoto
    Nov 21 '18 at 8:21











  • I have already the problem but whenever I enter the value for date it would always display error.

    – user3312649
    Nov 22 '18 at 1:56











  • Is that txtLname contained inside GridView's ItemTemplate or other container? If the textbox doesn't contained inside any container you can use the control name directly, but if using any container then you should use container name too, e.g. GridView1$txtLname.

    – Tetsuya Yamamoto
    Nov 22 '18 at 2:05











  • I recently just solved this, I have just put it inside the formlayout fields. sigh.

    – user3312649
    Nov 22 '18 at 3:45

















Please show the SqlDataSource and ASPxTextBox markup to let us find out possible cause of this issue. Try using txtLName_Init() event handler to see the unique ID, e.g. var textbox = sender as ASPxTextBox; Debug.WriteLine(textbox.UniqueID);.

– Tetsuya Yamamoto
Nov 21 '18 at 8:21





Please show the SqlDataSource and ASPxTextBox markup to let us find out possible cause of this issue. Try using txtLName_Init() event handler to see the unique ID, e.g. var textbox = sender as ASPxTextBox; Debug.WriteLine(textbox.UniqueID);.

– Tetsuya Yamamoto
Nov 21 '18 at 8:21













I have already the problem but whenever I enter the value for date it would always display error.

– user3312649
Nov 22 '18 at 1:56





I have already the problem but whenever I enter the value for date it would always display error.

– user3312649
Nov 22 '18 at 1:56













Is that txtLname contained inside GridView's ItemTemplate or other container? If the textbox doesn't contained inside any container you can use the control name directly, but if using any container then you should use container name too, e.g. GridView1$txtLname.

– Tetsuya Yamamoto
Nov 22 '18 at 2:05





Is that txtLname contained inside GridView's ItemTemplate or other container? If the textbox doesn't contained inside any container you can use the control name directly, but if using any container then you should use container name too, e.g. GridView1$txtLname.

– Tetsuya Yamamoto
Nov 22 '18 at 2:05













I recently just solved this, I have just put it inside the formlayout fields. sigh.

– user3312649
Nov 22 '18 at 3:45





I recently just solved this, I have just put it inside the formlayout fields. sigh.

– user3312649
Nov 22 '18 at 3:45












0






active

oldest

votes











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53393750%2fdefining-parameters-in-sqldatasource-in-devexpress%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes
















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53393750%2fdefining-parameters-in-sqldatasource-in-devexpress%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







這個網誌中的熱門文章

Tangent Lines Diagram Along Smooth Curve

Yusuf al-Mu'taman ibn Hud

Zucchini