Hi,
I want to use progressbar in one of my forms to track the completeness of the profile, I need to place server side validations on each control and after validating the text, i want to update the Progressbar,
For trial, I used two buttons which on every click add or subtract 25 from the progressbar,
After 1st postback the value gets changed but then after every subsequent postback the value remains same, I tried debugging and it is properly setting the value. Although while loading the complete page the value gets back to the previous one.
However this works fine with clientside scripting, I am just facing the issue on updating the value on the server side. Below is my code.
ASPX :-
<asp:Content ID="BodyContent" ContentPlaceHolderID="MainContent" runat="server">
<script>
function show(e) {
var progresObj = $("#<%=ProgressBar1.ClientID%>").data("ejProgressBar");
var x = parseInt(progresObj.getPercentage());
if (e == 'add') {
if (x < 100)
x += 25;
}
else {
if (x > 0)
x -= 25;
}
progresObj.option("text", x + " %");
progresObj.option("percentage", x);
}
</script>
<div class="row">
<asp:Button ID="btn1" runat="server" Text="+" OnClick="btn1_Click" />
<asp:Button ID="btn2" runat="server" Text="-" OnClick="btn2_Click" />
<input type="button" onclick="show('add')" value="Add" name="Add" />
<input type="button" onclick="show('sub')" value="Sub" name="Add" />
</div>
<div class="row">
<ej:ProgressBar ID="ProgressBar1" runat="server" Text="" Value="0">
</ej:ProgressBar>
</div>
</asp:Content>
CS :-
protected void Page_Load(object sender, EventArgs e)
{
}
protected void btn1_Click(object sender, EventArgs e)
{
if (ProgressBar1.Value < 100)
{
ProgressBar1.Value += 25;
}
}
protected void btn2_Click(object sender, EventArgs e)
{
if (ProgressBar1.Value > 0)
{
ProgressBar1.Value -= 25;
}
}
Please let me know if I have missed something or is there a solution to it.
Thank You,
Gaurang Kelkar