i wrote this telerik radComboBox
<asp:UpdatePanel ID="UpdatePanel17" runat="server" UpdateMode="Always">
<ContentTemplate>
<asp:HiddenField ID="hdfld_FlgCall" runat="server" />
<div class="form-group col-sm-6 ">
<label for="status" class=" control-label">عیب </label>
<div class="">
<%--OnClientKeyPressing="HandleKeyPress"--%>
<telerik:RadComboBox Skin="Bootstrap" ID="drpd_Defect" OnClientKeyPressing="HandleKeyPress" onkeyup="HandleKeyup(this);" OnClientDropDownOpened="peraperToChaneLanguageDefect" OnClientDropDownClosing="peraperToChaneLanguageDefect"
Culture="fa-IR" AutoPostBack="true" runat="server" EmptyMessage="انتخاب کنید"
AllowCustomText="True" DropDownAutoWidth="Disabled" Filter="Contains"
RenderMode="Auto" Width="100%" Height="200px" OnSelectedIndexChanged="drpd_Defect_SelectedIndexChanged">
</telerik:RadComboBox>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
But when i use breakPoint in code behind on SelectedIndexChanged , this method didn't called.
Where is my mistake?
I got confused
aow my goddddddd
i'm so sorry for Microsoft visual studio
I made some changes in the codebehind and use new feature in Visual Studio ---> Apply Code Change --- on run mode-
but this feature didn't work correctly
when I stop app and rerun the project my breakpoint work
Related
I am using LinkButton in a repeater control inside UpdatePanel in my asp.net project like This
<asp:Repeater ID="rep_test" runat="server">
<HeaderTemplate>
<div class="form-group">
<br />
</HeaderTemplate>
<ItemTemplate>
<div class="col-sm-6">
<div class="form-group">
<asp:LinkButton runat="server" ID="itemid" >
<div id="ab-1" class="moder profile-tile-box">
<div class="itemname-box">
<asp:Label ID="lbltets" runat="server" Text='<%# Bind("itmName") %>'></asp:Label>
</div>
</div>
</asp:LinkButton>
</div>
</div>
</ItemTemplate>
<FooterTemplate>
</div>
</FooterTemplate>
</asp:Repeater>
This worked fine for me but the problem is when I click on linkbutton it refreshes the whole page and regenerate all controls and close all open Modal.
how do I fix this issue .. please guide
Check runat=server causing postback...try OnClientClick=“...return false” in link button
You have to wrap your code inside a update panel to prevent a whole page reload
<asp:UpdatePanel ID="UpdatePanel1" runat="server" ChildrenAsTriggers="true">
<ContentTemplate>
// add your repeater here
</ContentTemplate>
</asp:UpdatePanel>
This will do partial postback on the part thats inside the update panel. Incase of modal put it inside the modal so it will not close the modal itself because it will else rebuild the modal resulting in closing it.
I've been trying for a while to find out the reason why the CommandName of a button does not work, in truth I always throw it empty when entering the onCommand event and even onClick of the same button despite putting the property with a value, the strange of the case is that I can not modify the property and putting the property CommandName works without problem the first time, however it is impossible for me to modify its value.
To start I have a ModalPopupExtender together with a Panel which has a series of TextBox and an AsyncFileUpload with a series of buttons, it is necessary to bear in mind that I am working on an ASPX form, son of a MasterPage:
<cc1:ModalPopupExtender ID="mpEditUser" runat="server" PopupControlID="pnEditUser" TargetControlID="lbShowEditUser"
CancelControlID="lbCloseEditUser" BackgroundCssClass="modalBackground">
<Animations>
<OnShown>
<FadeIn Duration="0.40" Fps="30" />
</OnShown>
<OnHiding>
<FadeOut Duration="0.40" Fps="30" />
</OnHiding>
</Animations>
</cc1:ModalPopupExtender>
<asp:Label ID="lbShowEditUser" runat="server" Text="" style="display:none;"></asp:Label>
<asp:Label ID="lbCloseEditUser" runat="server" Text="" style="display:none;"></asp:Label>
<asp:Panel ID="pnEditUser" runat="server" ClientIDMode="Static" tabindex="-1" role="dialog">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">
Modify User
</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="upEditUser" runat="server">
<ContentTemplate>
<p>Message</p>
<div class="form-group">
<label for="txtEditUser">Code</label>
<asp:TextBox ID="txtEditUser" runat="server" CssClass="form-control" ClientIDMode="Static" Enabled="false"></asp:TextBox>
</div>
<div class="form-group">
<label for="txtEditNameUser">Name</label>
<asp:TextBox ID="txtEditNameUser" runat="server" CssClass="form-control" ClientIDMode="Static" Enabled="false"></asp:TextBox>
</div>
<div class="form-group">
<asp:UpdatePanel ID="upX" runat="server">
<ContentTemplate>
<label class="">CV User</label>
<div class="input-group">
<label class="input-group-btn">
<span class="btn btn-primary">
Upload<cc1:AsyncFileUpload ID="fuCVUser" runat="server" class="form-control" style="display:none;" ClientIDMode="Static" OnUploadedComplete="fuCVUser_UploadedComplete" />
</span>
</label>
<input type="text" class="form-control" readonly disabled>
</div>
<span class="help-block">
<div class="form-inline">
<div class="form-group">
<asp:Button ID="btnDownloadCVUser" runat="server" CssClass="btn btn-default" ClientIDMode="Static" CommandArgument="Test" OnCommand="btnDownloadCVUser_Command" Text="Download" />
</div>
</div>
</span>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel ID="upControlsEditUser" runat="server">
<ContentTemplate>
<asp:Button ID="btnCloseEditUser" runat="server" AutoPostBack="true" CausesValidation="true" Text="Close" class="btn btn-default" data-dismiss="modal" OnClick="btnCloseEditUser_Click" aria-hidden="true" />
<asp:Button ID="btnEditParticipant" runat="server" AutoPostBack="true" CausesValidation="true" Text="Update User" class="btn btn-primary" data-dismiss="modal" OnClick="btnEditUser_Click" aria-hidden="true" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</asp:Panel>
Event onCommand:
protected void btnDownloadCVUser_Command(object sender, CommandEventArgs e)
{
string x = e.CommandArgument; <- (this value is always "")
}
To get out of doubt, I decided to put the "btnDownloadCVUser" control out of the Panel
............
</asp:UpdatePanel>
</div>
</div>
</div>
</asp:Panel>
<asp:Button ID="btnDownloadCVUser" runat="server" CssClass="btn btn-default" ClientIDMode="Static" CommandArgument="Test" OnCommand="btnDownloadCVUser_Command" Text="Download" />
This worked successfully on the CommandArgument, that is, I could see its assigned value on the label and manage to modify its value.
I tried to put UpdatePanel together with the AsyncFileUpload in such a way that it encloses the "from-group" with the triggers but I keep presenting the same problem. It's very strange because I have a button that does exactly the same thing but it's NOT in a MomalPopupExtender
Why does this happen?
Does ModalPopupExtender or AsyncFileUpload have something to do with the problem?
Does the level of the "form-group" have anything to do with it?
So far the only lifeguard I have is to use ViewState, but I'm still intrigued by the reason that causes my problem :(
Update 01:
I have noticed that the reason seems to be the method with which I load the files (AsyncFileUpload), apparently if I try to change a variable for this it turns out that it is as if I did not, but it allows me to upload the files without problem. Is there any solution?
private int a = 0;
protected void fuCVUser_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
a = 10; < - The value changes to '10' but if I enter the event of another button of the ModalPopupExtender the value is still '0'
}
After seeing this question:
Persisting variable after AsyncFileUpload call to OnUploadedComplete
I have come to the conclusion that it is enough to use a static global variable or Session :)
Apparently the AsyncFileUpload method works with static variables which could justify the problem with CommandArgument
In my asp.net application there are several dropdown and textbox control which creates dynamically. So on select of dropdown while data is being fetched I want to show update progress on div. Also I dont want to post back call so whole page should not be refreshed.
Here is my code
<div class="col-md-2">
<div class="filter-section">
<table>
<tr>
<td>
<asp:Panel ID="ControlsParent" ViewStateMode="Enabled" ClientIDMode="Static" runat="server"></asp:Panel>
</td>
</tr>
<tr>
<td>
<asp:Button ID="BtnShowReport" runat="server" ClientIDMode="Static" CssClass="btn btn-primary btn-block" Text="Show Report" OnClick="BtnShowReport_Click" />
</td>
</tr>
</table>
</div>
</div>
I am new to Telerik so dont have idea to use.
Put the code insiode the Update Panel, I am using Simple asp and haven't used Telerik in following:
// you code codes here
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdateProgress DynamicLayout="true" ID="upProgSearch" DisplayAfter="1500" runat="server" >
<ProgressTemplate>
<div id="progressBackgroundFilter"></div>
<div id="processMessage" style="width:100px;">
<asp:Image ID="Image1" ImageUrl="~/images/Loading.gif" runat="server" />
</div>
</ProgressTemplate>
</asp:UpdateProgress>
for preventng auto postback use <triggers> tags in update panel and use <asp:AsyncPostBackTrigger> and specify the event name that causes postback and you don't want .
I have grid view inside an update panel which on click of link button fires grid view row command event.
On this row command event I want to open a bootstrap popup and bind another grid from code behind which is also in an update panel.
Problem is grid view fires row command event and data is fetched correctly and binds it to the popup grid view but popup does not display's data of newly bound grid view.
I have tried triggers as well for update panel my code is please help me, I am really stuck in this, thanks in advance
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional" ChildrenAsTriggers="false">
<ContentTemplate>
<asp:GridView ID="gvResponseList" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ListId"
Width="550px" AllowPaging="True" OnRowCommand="gvResponseList_RowCommand" CssClass="table table_standard_inbox table-striped table-bordered">
<Columns>
<asp:TemplateField HeaderText="Response">
<ItemTemplate>
<asp:LinkButton class="popup" data-toggle="modal" ID="lnkbtnSelectAnswer" Visible='<%#Eval("ResponseTitle") != null %>' runat="server" Text="Choose From Previous Answer" CommandName="AddAnswerToTextBox" CommandArgument='<%# ((GridViewRow) Container).RowIndex %>'></asp:LinkButton>
<br />
<asp:TextBox ID="txtResponse" runat="server" TextMode="MultiLine" Height="60px" Width="400"></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" Display="Dynamic"
ValidationGroup="Submit" ControlToValidate="txtResponse" ErrorMessage="*"></asp:RequiredFieldValidator>
<br />
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<b>No record found</b>
</EmptyDataTemplate>
</asp:GridView>
</ContentTemplate>
<Triggers>
<asp:AsyncPostBackTrigger ControlID="gvResponseList" EventName="RowCommand" />
</Triggers>
</asp:UpdatePanel>
<!-- Modal -->
<div class="modal fade" id="divPreviousResponses" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Prevoius Answers</h4>
</div>
<div class="modal-body">
<asp:GridView ID="gvSelectAnswer" runat="server" AutoGenerateColumns="False" CellPadding="4" DataKeyNames="ListId"
Width="550px" AllowPaging="True" ItemType="TextualUserAnswersEntity" OnRowCommand="gvSelectAnswer_RowCommand" OnPageIndexChanging="gvSelectAnswer_PageIndexChanging">
<Columns>
<asp:TemplateField HeaderText="Previous Response">
<ItemTemplate>
<asp:UpdatePanel ID="UpdatePanel1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Label ID="lblResponse2" runat="server" Text='<%#Eval("ResponseTitle") %>'></asp:Label>
</ContentTemplate>
</asp:UpdatePanel>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<EmptyDataTemplate>
<b>No record found </b>
</EmptyDataTemplate>
</asp:GridView>
</div>
<div class="modal-footer">
<button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
</div>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
<!-- /.modal -->
I would resolve this issue in the following way:
1. display the gridView as some HTML table formatted by jQuery's dataTable lib
The data for this table has to be sent as Json by the server side
2. On click even of your table rows make Ajax call to your server side to get (as Json) some other information you need to display and parse it into the body of your Bootstrap's modal.
All this will perfectly work and what is also important - it will work faster than how you are trying to do it now
I have a asp:Button that has an onclick function. Is there a way to eliminate the refresh that occurs?
Current HTML containing button.
<div id="user" class="font">
<div id="userPanel">
<asp:TextBox ID="txtSearch" runat="server" Width="400px" align="left"></asp:TextBox>
<asp:Button ID="searchbutton" text="enter" runat="server"
onclick="searchbutton_Click" />
<asp:Label ID="test" runat="server"></asp:Label>
</div>
<asp:UpdatePanel ID="userinfoupdatepanel" runat="server">
<ContentTemplate>
<div class="topcontent">
<ul>...</ul>
</div>
</ContentTemplate>
</asp:UpdatePanel>
The button click then calls a function that fills the UL content
You can use OnClientClick to bind a Javascript function to handle the click in the browser. If you return false from that fumction, the postback doesn't happen.
You can also add client events using Attributes collection.
searchbutton.Attributes.Add("onclick", "alert('Test')");
searchbutton.Attributes.Add("onclick", "return fnSomeThing(this);");