Skip to main content

Populate Modal popup data which is bind to a link button - ASP.net

I wanted to do a POC to my client to show modal popup functionality. So I did a simple page with one Button and a TextBox. That Button is responsible to popup the modal window. On that ModalPopup I implemented a search mechanism. I used Girdview control to show the search result.

I wanted to populate the id value of that search result which was binded to a link button. This gridview and the text box and button was in a AJAX update panel control. I did this because I wanted to have the smothness of the UI.

Now I met a new problem. Because I wanted to get that value out of that LinkButton control and show it in a TextBox control which was out of the ModalPopup.

So what I did was, I just assign that LinkButton's text property to a HiddenField and I used a JavaScript function to populate that HiddenField value the TextBox.

As you all know we need a Panel control to show our ModalPopup. This is gonna be a <div> on the HTML. So I used the onblur event to call my JavaScript function.

So my problem is solved. :D

I think this will help you all one day.

Comments

Popular posts from this blog

Exit a T-SQL Cursor When Condition is met

Have you ever wanted to exit from a cursor when a condition is met? I wanted to do it. So this is how I did it. DECLARE @Field1 AS INT DECLARE @Field2 AS INT DECLARE CursorName CURSOR READ_ONLY FOR SELECT Field1, Field2 FROM TableName OPEN CursorName FETCH NEXT FROM CursorName INTO @Field1, @Field2 WHILE @@FETCH_STATUS = 0 BEGIN IF @Field1 = 1 BEGIN GOTO ENDCURSOR END FETCH NEXT FROM CursorName INTO @Field1, @Field2 END ENDCURSOR: CLOSE CursorName DEALLOCATE CursorName I have set my fonts to bold where you want to notice. So that's all I hope you will get something out of it and it is true that this is not a big deal. :)

Common Design Principles

There are number of common design principles that, like design patterns, best practice over the years to build maintainable software. I'm up to describe some widely used design principles though out the post. Following common principle are extracted by the same book that I mentioned before ( Professional ASP.Net Design Patterns - Scott Millet ). Principles are as follows: Keep It Simple Stupid (KISS) One common issue in software programming is over-complicating a solution. So main concern of this principle is keep the code simple but not simplistic. Eventually this will avoid unnecessary complexities. Don't Repeat yourself (DRY) Main concern of this principle is to avoid the repetition. In other words this is all about abstracting out the common functionalities into a single place. Ex: If there is a price calculation method in a system. It should lay in a single place there. Tell Don't Ask The Tell, Don’t Ask principle is closely aligned with encapsulation and the assignin...

An error occurred while starting the application in ASP.NET Core on IIS

I got this following error when I hosted my ASP.NET Core 2.2 web API on IIS. An error occurred while starting the application. .NET Core 4.6.27317.07 X64 v4.0.0.0 | Microsoft.AspNetCore.Hosting version 2.2.0-rtm-35687 (Please ignore the version numbers. Just wanted to show the error as it was.) So my first step was to change the  stdoutLogEnabled=true in web.config,  but couldn't find the logs folder. Few mins later I learnt that the  AspNetCoreModule   doesn’t create the logs folder for you by default (Hope they will fixed soon). It logs the error to the Event Viewer which says: Warning: Could not create stdoutLogFile  Path\logs\stdout_xxxxx.log, ErrorCode = -2147024893 . So, I created the the logs folder manually and here I find the real reason why it is failing. Hope this will help you guys.